ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » WMQ JMSRA Failover Solved! - MAYBE

Post new topic  Reply to topic
 WMQ JMSRA Failover Solved! - MAYBE « View previous topic :: View next topic » 
Author Message
shadowrunner52
PostPosted: Fri May 09, 2008 6:11 am    Post subject: WMQ JMSRA Failover Solved! - MAYBE Reply with quote

Novice

Joined: 07 Sep 2007
Posts: 10

I've been working on setting up a 2 node MQ cluster for the purposes of handing failover if one node goes down, either planned or unplanned. I am using the WMQ JMSRA on JBoss 4.0.5.

I got the CCDT all figured out and configured in my wsmq-ds.xml file however everything I could find on handling failover indicated that it would need to be coded for on the client side.

Well I figured that instead of having to change the code in all of our deployed applications that there had to be another way. So after much fiddling I discovered that if I extend the
Code:
ManagedQueueConnectionFactoryImpl
class and override the
Code:
matchManagedConnections
method that I can test to see if the connection is still valid. If it isn't I can just return a null and the resource adapter will create a new connection. Here is my method code:

Code:

public ManagedConnection matchManagedConnections(Set arg0, Subject arg1, ConnectionRequestInfo arg2) {
  for(Iterator i=arg0.iterator();i.hasNext();) {
    ManagedQueueConnectionImpl conn = (ManagedQueueConnectionImpl)i.next();
    MQQueueSession session = null;
    try {
      session = (MQQueueSession)conn.getPhysicalSession();
      session.createTemporaryQueue();
    } catch (JMSException e) {
      try {
        if(conn.isTransactionStarted()) {
          session.rollback();
        }
        conn.destroy();
      } catch (JMSException e1) {
        e1.printStackTrace();
      }
      return null;
    }
  }
  return super.matchManagedConnections(arg0, arg1, arg2);
}


I created a single class, exported it into a .jar, stuck it in the wmq.jmsra.rar archive and deployed it to my JBoss instance and so far it seems to be working.

DISCLAIMER - This solution has not been at all thoroughly tested. Use at your own risk!

If anyone has a better solution, or suggestions on how to improve this one then please let me know.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » WMQ JMSRA Failover Solved! - MAYBE
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.