Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using CDI in Quartz Jobs

I would like to know if it is possible to use CDI beans in Quartz jobs in a portable way?

I have already tried to write my own JobFactory and so on, but the problem is, that the BeanManager is not available through JNDI, because the job runs in a non managed thread. My application server is Websphere 8.0.0.1 and I already read that it is against the EE6 spec to make the name "java:" available to non managed threads.

There are two solutions now I think:

  1. Let Websphere create the worker threads(Don't know how to do that, any help would be nice)
  2. Implement an EJB and call the method through the EJBJobInvoker

I know that, when I use the CDI solution, then I am not able to let the worker threads run in a different JVM, correct me if I am wrong. To stay scaleable I should implement an EJB for that? What do you think, have you ever had that problem? I would also appreciate different solutions or even suggestions on different scheduler libraries!

like image 574
Christian Beikov Avatar asked Dec 12 '25 22:12

Christian Beikov


1 Answers

Look at DeltaSpike scheduler module.

You can find last version on Maven Central Repository.

like image 54
Anthony O. Avatar answered Dec 15 '25 05:12

Anthony O.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!