Ad

Saturday 8 May 2010

Difference between consumption paused and production paused in weblogic JMSDestinationRuntimeMBean

We can programmatically pause a queue in weblogic by using Mbean JMSDestinationRuntimeMBean.
The methods Mbeans provide for this are pauseConsumption() and pauseProduction()

Pause Production
The queue can be production paused as shown below:

Destination queue = (Destination) context.lookup("queue JNDI name");
weblogic.management.runtime.JMSDestinationRuntimeMBean destBean = weblogic.jms.extensions.JMSRuntimeHelper.getJMSDestinationRuntimeMBean(
context, queue);
destBean.pauseProduction(); //Will pause the queue

If the sender try to send the message to the above paused queue,it will get an exception.Then if the queue is resumed(resumeProduction()),the previous sent messages are lost.

Pause Consumption:
The queue can be consumption paused as shown below:

destBean.pauseConsumption(); //Will pause the queue                                                                             

The sender of the queue can able to send message to the above queue,but the receiver can't get the message as the queue is consumption paused.once the queue is resumed(resumeConsumption()),the previous sent messages are not lost and will be received by the receiver.

1 comment: