Quartz 强制消息驱动作业非并发
我有一个石英驱动的消息驱动 bean:
@MessageDriven(activationConfig={@ActivationConfigProperty(propertyName="cronTrigger", propertyValue="* * * * * ?")})
@ResourceAdapter(value="quartz-ra.rar")
public void SomeJob implements Job {
@Override
public void execute(final JobExecutionContext job) throws JobExecutionException() {}
}
现在我明白,如果我将 SomeJob 更改为 StatefulJob,则任何时候都只会发生一次执行。每个触发器都会等待前一个作业完成。这就是我所需要的,我已经看到 StatefulJob
已被弃用,而 @DisallowConcurrentExecution
是替代品。这可以与 EJB dessage 驱动的 Bean 一起使用吗?
另一个问题(很可能值得一个新问题),如果我的工作每秒被触发(如上所述),但有时需要一分钟来执行积压的工作所发生的情况。积压工作是否有最大大小,这会在某个时候引发错误吗?如果当前正在执行作业,是否有办法强制忽略作业?
I have a quartz driven message driven bean:
@MessageDriven(activationConfig={@ActivationConfigProperty(propertyName="cronTrigger", propertyValue="* * * * * ?")})
@ResourceAdapter(value="quartz-ra.rar")
public void SomeJob implements Job {
@Override
public void execute(final JobExecutionContext job) throws JobExecutionException() {}
}
Now I understand that if I change SomeJob to be a StatefulJob
only one execution will happen at any single time. Each trigger will wait for the previous job to complete. This is what I require, I have seen that StatefulJob
is deprecated and @DisallowConcurrentExecution
is the replacement. Does this work with EJB dessage driven beans?
Another issue (may well deserve a new question), if my job is being triggered every second (as above), but sometimes takes a minute to execute what happens to the backlog of jobs. Is there a max size on the backlog, will this throw an error at some point? Is there a way of forcing jobs to get ignored if a job is currently being executed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我真的不明白你想达到什么目的?
当 Quartz 发现触发器的预定触发时间已到时,就会调用 Quartz 作业。此外,Quartz 还可以实例化作业实例(通过 JobFactory 接口)。
当消息到达 JMS 目标(bean 配置为从中使用)时,将调用 MessageDrivenBean。在这种情况下,EJB 容器就是实例化类实例的东西。
我不明白你希望如何同时创造出两者兼备的东西?!?!?
I really can't understand what you're trying to accomplish?
A Quartz job is invoked when Quartz finds a trigger who's scheduled fire time has arrived. Also, Quartz is the thing that instantiates the job instance (via the JobFactory interface).
A MessageDrivenBean is invoked when a message arrives in a JMS destination (that the bean is configured to consume from). In this situation the EJB container is the thing that instantiates the class instance.
I don't understand how you're expecting to create something that is both at the same time?!?!?