Ad

Friday 14 May 2010

Initial Context(JNDI) lookup from one weblogic to another weblogic

There may be scenarios where we may deploy our webapplication in one weblogic server and may use the EJB or the destination objects(Queue/Topic) deployed in other weblogic.In order to use this remote resource When we try to get the Initial context of the weblogic2 from the webapplication in weblogic1,we will not get the connection if any of the below unique requirements fails

(1) The WLS server name should be unique in both the weblogic servers.
(2) The Domain Name should be unique in both the weblogic servers.
(3) For messaging(Connection factories and topic/queue) lookup,the JMS Server Name
and the queue/topic name should be unique in both the servers

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.