[英]How to stop message delivery to a Message Driven Bean?
Question 题
Is it possible to stop a Message Driven Bean (programmatically), so that it doesn't consume new messages, but processes running transactions as usual? 是否可以(以编程方式)停止消息驱动Bean,以便它不消耗新消息,而是像往常一样处理正在运行的事务?
(This is a follow up of How to stop message processing before undeploying? ). (这是如何在取消部署之前停止消息处理的后续操作? )。
Given 特定
Failed Attempts 尝试失败
stopDelivery
, but sadly it closes transactions immediately (see bug #EJBTHREE-1870 ) and thereby causes a lot of exceptions. stopDelivery
,但可悲的是它立即关闭了事务(请参见Bug #EJBTHREE-1870 ),从而导致许多异常。 NameNotFoundException
s within the producers. NameNotFoundException
。 Well here is a though, almost everything can be achieved with a wrapper, You can let MDB keep receive message, but introduce a Boolean stopDelivery, while before message going to be processed by business logic, check if stopDelivery is set to true, if so, resend the message back to your queue where it is came from. 好了,尽管这几乎可以用包装器完成。您可以让MDB保持接收消息,但是引入一个布尔值stopDelivery,而在业务逻辑要处理消息之前,请检查stopDelivery是否设置为true,如果是这样,将邮件重新发送回您的队列。
So even the queue is still moving, but unless u unset stopDelivery, the content of the queue is kind of freeze 因此,即使队列仍在移动,但是除非您未设置stopDelivery,否则队列的内容会冻结
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.