在石英作业中使用CDI [英] Using CDI in Quartz Jobs
问题描述
我已经尝试编写自己的JobFactory等但是问题是,BeanManager不能通过JNDI使用,因为作业运行在非托管线程中。我的应用程序服务器是Websphere 8.0.0.1,我已经看到它是针对EE6规范,使名称java:可用于非管理线程。
有现在我想到两个解决方案:
- 让Websphere创建工作线程(不知道该怎么做,任何帮助都会很好)
- 实现EJB并通过EJBJobInvoker调用该方法
我知道,当我使用CDI解决方案,那么我不能让工作线程运行在不同的JVM中,如果我错了就纠正我的错误。为了保持可扩展性,我应该为此实现一个EJB?你怎么看,你有没有遇到过这个问题?我也会喜欢不同的解决方案,甚至不同的调度程序库的建议!
查看 DeltaSpike调度程序模块。
您可以在 Maven Central Repository 。
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:
- Let Websphere create the worker threads(Don't know how to do that, any help would be nice)
- 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!
Look at DeltaSpike scheduler module.
You can find last version on Maven Central Repository.
这篇关于在石英作业中使用CDI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!