问题
Can we pause the MDB message processing for some time? For example: Jboss 1-deployed MDB for message processing. Jboss 2:-Bean for gathering user details. If the MDB from jboss 1 calls bean in jboss 2 for getting users details. If this is the case, when we restart the Jboss 2, we need to pause the MDB in jboss 1 till the jboss 2 is UP. Is there any option to pause MDB, so that we can avoid failure of message?
回答1:
I doubt you can stop an MDB without stopping the whole application. It is possible with Spring JMS, but not with regular message driven beans.
What you could do, and is apparently possible, is pausing a queue. HornetMQ does give you the possibility to switch the queue to "receive only mode", though I don't know if this is available via the admin console.
回答2:
In JBoss (4.x and 5.x), you can look up the MDB through the JMX Console and pause delivery of messages.
- Go to the jmx console (
http://yourserver:8080/jmx-console/
where 8080 is the HTTP port) - Click
jboss.j2ee
in the left-hand pane In the right-hand pane, find and click on your MDB. Usually, it will look something like
jar=file-containing-your-MDB.jar,name=NameOfYourMDB,service=EJB3
- To pause, click the "Invoke" button next to "stopDelivery"
- To resume, click the "Invoke" button next to "startDelivery"
回答3:
You can stop the Queue on HornetQ. (I'm not sure about JBoss Messaging, but I'm pretty sure you do)
Look for the message pause and resume on the JMX Console
来源:https://stackoverflow.com/questions/8385244/pause-mdb-message-processing