EAP中运行重复任务

EAP中运行重复任务

本文介绍了如何避免在高可靠性集群JBoss EAP中运行重复任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在开发需要有一些后台作业的应用程序,例如在待处理的警报上发送电子邮件。在独立配置中,作业使用Spring调度程序和调度任务进行配置和工作。
但是我不知道如何使它们在高可用性的JBoss环境下同步工作。主要问题是避免不同节点上的作业同时运行。

Im developing an application that needs to have some background jobs, for example for sending emails on pending alerts. In a standalone configuration the jobs are configured and working fine with Spring scheduler and scheduled-tasks.But i don't know how to make them work synchonized on a clustered with high avaliability JBoss environment. The main problem is to avoid that jobs on different nodes run at the same time.

我已经阅读了关于Quartz:

I've read this about Quartz:

但是在高可用性情况下不建议使用它:

But it's not recomended on on a high avaliability scenario:

到现在为止,我们的服务/ its.htm解决了自制阻塞系统的同步问题()。但我想知道JBoss是否为这个常见的问题提供了一些解决方案。

By now i have workarounded the synchronization problem with a self made blocking system (Why my pessimistic Locking in JPA with Oracle is not working). But i wish to know if JBoss provides some solution for this certainly common problem.

推荐答案

您可以尝试一个HA Singleton一个EJB Singleton配置为仅在集群中的一个节点上运行。然后,该单例可以使用EJB Timer服务来调度作业。请参阅有关HA singleton的文档:

You can try an HA Singleton, which is an EJB Singleton configured to be only running on one node in a cluster. That singleton can then use the EJB Timer Service for scheduling your jobs. See the documentation about HA singleton: https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Development_Guide/Implement_an_HA_Singleton.html

这篇关于如何避免在高可靠性集群JBoss EAP中运行重复任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 06:04