Question

I have two clustered managed servers running on Weblogic, and seperate JMS server1 and server2 are running on each managed server. The problem is in application properties file, we only hardcoded and pass JMS server1 JNDI name to the application. So both applications running on each node actually only uses one fixed JMS server, which is not truly distributed and clustered. If JMS server 1 is down, the whole application will be down.

My question is how to let application dynamically find JMS server in above senario? Can you please point me a direction? Thanks!

Was it helpful?

Solution

It's in the Weblogic docs at: http://docs.oracle.com/cd/E14571_01/web.1111/e13738/best_practice.htm#CACDDFJD

Basically you created a comma separated list of servers and the JMS connection logic should be automatically able to handle to case when one of the servers is down:

e.g.

t3://hostA:7001,hostB:7001

OTHER TIPS

When you use a property like jms.jndi.provider.url=t3://hostA:31122,hostA:31124
it tells wls to connect to either hostA:31122 or hostA:31124. Note your JMS client is connected to only one Host at any given time. when you shutdown hostA the connection between JMS client and server is cut abruptly resulting in an exception, your code will have to handle this exception gracefully and attempt to connect to WLS again periodically to ensure it connects to hostB.

WLS internally will round robin the request if more than 1 instance of the JMS client is running.

When using MDB as JMS client and deploying it to a cluster and using such a url 1 mdb instance would connect to one host and the other instance would connect to another host. MDB also inherently has the ability to reconnect periodically to the JMS destination.

A easy solution to your problem could be to 1) Set the jms.jndi.provider.url=t3://hostA:31122,hostA:31124 2) Have 2 instance of the JMS client code running, so one will connect to port 31122 and other to 31124 3) Set Forward-Delay on the JMS Queue so that message dont remain in queue without getting consumed for long and get forwarded to the other queue which has an active consumer.

I am updating my progress here instead of adding more comments. I have tested using a standalone JMS client by changing properties file from t3://hostA:7001 to t3://hostA:7001,hostB:7001 for JMS provider. The failover is automatically handled by WLS. No code change. The exception I got above is caused by using wlclient.jar, it is working after it changed to wlfullclient.jar.

I followed this link to generate wlfullclient.jar.

Thanks everyone!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top