Results 1 to 2 of 2

Thread: reconnect to MQ Queuemanager?

  1. #1
    Join Date
    Jan 2006
    Posts
    18

    Default reconnect to MQ Queuemanager?

    Hi,

    We have a jmstemplate that post messages to MQ, but sometimes we loose contact with the MQ Queuemanger and after that every sends fails...

    Is there a way to reconnect/reinitialize the connectionfactories in spring?

    Here's our the relevant parts of our config:
    <bean id="MQConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="hostName" value="${websphere.mq.host}" />
    <property name="port" value="${websphere.mq.port}" />
    <property name="channel" value="${websphere.mq.channel}" />
    <property name="queueManager" value="${websphere.mq.qmanager}" />
    <property name="transportType" value="${websphere.mq.transport}" />
    </bean>

    <bean id="mq-jms-connection-factory" class="org.springframework.jms.connection.CachingC onnectionFactory">
    <property name="targetConnectionFactory" ref="jmsQueueConnectionFactory" />
    </bean>

    <bean id="jmsQueueConnectionFactory" class="org.springframework.jms.connection.UserCred entialsConnectionFactoryAdapter">
    <property name="targetConnectionFactory" ref="MQConnectionFactory" />
    <property name="username" value="${websphere.mq.user}" />
    <property name="password" value="${websphere.mq.pwd}" />
    </bean>

    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="mq-jms-connection-factory" />
    <property name="messageConverter" ref="lbsMessageConverter" />
    </bean>

    <bean id="klientForesporselJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="mq-jms-connection-factory" />
    <property name="messageConverter" ref="klientMessageConverter" />
    </bean>

  2. #2
    Join Date
    Aug 2011
    Posts
    1

    Default

    We are experiencing this same issue. Actually to be exact it seems that sometimes when an mq queue becomes unable, the connection IS re-established, but other times it is not. it seems that when the entire queuemanager is bounced the connection is re-established but when the manager is bounced by operations with a nightly script (haven't root-caused the difference) we do NOT reconnect.

    ARe others experiencing this? Is there some configuration we can change?

    We are using jmstempate for sending like this:




    Code:
    //snippets
    
    // spring bean.. see below config
    public class JmsDistributionPoint implements DistributionPoint {
    
    private final JmsTemplate jmsTemplate;
    private final String queueName;
    
     @Override
       public void send(final Message outboundMessage)  {
          final String messageXml = converter.getConvertedPayload(outboundMessage);
          jmsTemplate.send(queueName,
             new MessageCreator() {
                @Override
                public Message createMessage(Session session) throws JMSException {
                   TextMessage message = session.createTextMessage();
                   return makeTextMessage(message , outboundMessage, messageXml);
                }
             });
       }
    application-context:

    Code:
    // NB: 'xxx' simply obscuring company details
    
    <bean id="xxx_DP_ONE" class="com.[xxx].model.configuration.distribution.JmsDistributionPoint">
          <constructor-arg value="${xxx.queue.name}"/>
          <constructor-arg ref ="xxxConnectionFactory"/>
       </bean>
    <bean id="[xxx]ConnectionFactory" 
          class="org.springframework.jms.connection.CachingConnectionFactory"> 
          <property name="targetConnectionFactory" ref="xxxConnectionFactoryImpl"/> 
          <property name="sessionCacheSize" value="1"/> 
       </bean> 
    
    <bean id="xxxConnectionFactoryImpl" class="com.ibm.mq.jms.MQQueueConnectionFactory">
          <property name="transportType" ref="transportTypeConst"/>
          <property name="queueManager" value="${xxx.queue.manager}"/>
          <property name="hostName" value="${xxx.queue.host}"/>
          <property name="port" value="${xxx.queue.port}"/>
          <property name="channel" value="${xxx.queue.channel}"/>
        </bean>

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •