@Romain

Thanks for sharing your thoughts and thanks for reminding (think I've seen
it in some tutorial) me of the trick, this way I not need to devide the
func in two seperate classes.

Regards
LF



On Sat, Apr 18, 2015 at 7:58 PM, Romain Manni-Bucau <[email protected]>
wrote:

> last time I did it it was with a @Singleton @Startup starting an async task
> in @PostCOnstruct and waiting for shutdown in @PreDestroy.
>
> Little trick: to start an async method from "this" inject SessionContext
> (sc) and  do sc.getBusinessLocal(MyEjb.class).myAsync();
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-04-18 16:59 GMT+02:00 Lars-Fredrik Smedberg <[email protected]>:
>
> > Understand that... Unfortunately we are running Java EE6 in production
> and
> > cannot pull it in as a third party prod for various reasons
> > On Apr 18, 2015 4:58 PM, <[email protected]> wrote:
> >
> > > I am very happy with jbatch aka batchee.
> > >
> > > Skickat från min iPhone
> > >
> > > > 18 apr 2015 kl. 16:36 skrev Lars-Fredrik Smedberg <
> [email protected]
> > >:
> > > >
> > > > Hi
> > > >
> > > > I need to run a background task that will poll messages from a
> > > > BlockingQueue, aggregate data (to some degree) and at regular
> intervals
> > > > write the data to a file (append to a file).
> > > >
> > > > Each appserver instance will write to its own file so there is no
> need
> > to
> > > > sync within a cluster or similar...
> > > >
> > > > I guess I could at startup create my own thread and peek the queue
> > etc...
> > > > but if I would keep it more strict Java EE 6 and also need access to
> > > > @ApplicationScoped beans then I guess I could either use a one-off
> > > > programmatic EJB timer or calling an @Asynchronous EJB methos
> > > > (started/called from a @Singleton @Startup... EJB).
> > > >
> > > > What is the preferred approach you would use?
> > > >
> > > > Regards
> > > > LF
> > >
> >
>



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at [email protected], and destroy all copies of this
message and any attachments.

Reply via email to