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?
(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.NameNotFoundException
s 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