开发者

How to stop message delivery to a Message Driven Bean?

开发者 https://www.devze.com 2023-03-06 19:54 出处:网络
Question Is it possible to stop a Message Driven Bean (programmatically), so that it doesn\'t consume new messages, but processes run开发者_StackOverflow社区ning transactions as usual?

Question

Is it possible to stop a Message Driven Bean (programmatically), so that it doesn't consume new messages, but processes run开发者_StackOverflow社区ning transactions as usual?

(This is a follow up of How to stop message processing before undeploying?).

Given

  • JBoss 4.2.3 with JBoss Messaging
  • a Message Driven Bean according to EJB 2.0

Failed Attempts

  • I'd like to use the MBean method stopDelivery, but sadly it closes transactions immediately (see bug #EJBTHREE-1870) and thereby causes a lot of exceptions.
  • I tried to reduce the max pool size to 0 in the JMX console, but the number of active sessions isn't affected at all.
  • I could stop the queue, but than I have to handle NameNotFoundExceptions within the producers.


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.

So even the queue is still moving, but unless u unset stopDelivery, the content of the queue is kind of freeze

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号