Announcement Announcement Module
No announcement yet.
reconnect to MQ Queuemanager? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • reconnect to MQ Queuemanager?


    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="">
    <property name="hostName" value="${}" />
    <property name="port" value="${}" />
    <property name="channel" value="${}" />
    <property name="queueManager" value="${}" />
    <property name="transportType" value="${}" />

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

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

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

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

  • #2
    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:

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

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