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 » Modifying existing client for multi-instance using SVRCONN

Post new topic  Reply to topic
 Modifying existing client for multi-instance using SVRCONN « View previous topic :: View next topic » 
Author Message
Gideon
PostPosted: Fri Aug 23, 2013 12:55 pm    Post subject: Modifying existing client for multi-instance using SVRCONN Reply with quote

Chevalier

Joined: 18 Aug 2009
Posts: 403

I was given Java code using SVRCONN to send messages, below is a portion:

Code:
  private static String host    = "10.14.101.191";
  private static int    port    = 1414;
  private static String channel = "SYSTEM.ADMIN.SVRCONN";
  private static String qmgr    = "WQM";
  private static String qName   = "TEST";

  ....

  cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, host);
  cf.setIntProperty(WMQConstants.WMQ_PORT, port);
  cf.setStringProperty(WMQConstants.WMQ_CHANNEL, channel);
  cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
  cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, qmgr);


For various reasons, I need to continue use of the SVRCONN channel.

All of the documentation I have seen refers to the CONNAME attribute, as follows

Code:
   CONNAME('host(port),host(port)')


However, CONNAME is not an attribute of SVRCONN

Since SVRCONN are 1 socket connections directly assigned to the server, and I can see no examples of how to do this, the only solution I can think of is to connect to the channel, but trap for a JMS exception, something like:

Code:
      private static String host           = "10.14.101.191";
      private static String standbyhost    = "10.14.101.192";
      ...

      catch (JMSException jmsex) {
        System.out.println("-- Switching to standby instance on another IP");

        cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, standbyhost);
        connection  = cf.createConnection();
        session     = connection.createSession(txEnabled ? true : false, Session.AUTO_ACKNOWLEDGE);
        queue       = session.createQueue(qName);
        producer    = session.createProducer(queue);

        producer.setDeliveryMode(DeliveryMode.PERSISTENT);
        connection.start();
        break;
      }


and then reconnect using the other standbyhost IP.

The MQ Explorer must have a solution to this, since they collect two different IP's for a single SVRCONN.

I find my potential solution clunky, what would be the recommended approach to using SVRCONN in a java client when writing for potential failover?
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Sat Aug 24, 2013 6:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You need to use the connectionNameList property of the cf. (value= ('host(port),host(port)')
Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Modifying existing client for multi-instance using SVRCONN
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.