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 » New session created when sending message using JMSTemplate

Post new topic  Reply to topic
 New session created when sending message using JMSTemplate « View previous topic :: View next topic » 
Author Message
pvasha
PostPosted: Wed Oct 12, 2011 3:08 am    Post subject: New session created when sending message using JMSTemplate Reply with quote

Newbie

Joined: 12 Oct 2011
Posts: 1

I am using JMSTemplate to send message to the external system. There is limit on number of connections allowed to the external system.
I am sending the message one by one though loop.
I have seen the JMSTemplate class definition and the method doSend close the connection every time. Though my each operation to send message take individual connection and number of connection reached to the upper limit set by the external system.
I am using Spring version 2.0.2 and the application is deployed on Tomcat6.


I am using SingleConnectionFactory to get the connection. Below snipet is from the configuration file and code.

Spring Configuration File:
=====================
Code:

<!-- connection factory for local queue -->
      <bean id="jmsConnectionFactory"
            class="org.springframework.jms.connection.SingleConnectionFactory">
            <property name="targetConnectionFactory">                                         
                        <ref bean="queueConnectionFactory"/>
            </property>
            <!--  <property name="username" value="" />
            <property name="password" value="" />-->
      </bean>

      <!-- Actual connection factory setting. Need to load the information from jms.properties -->
      <bean id="queueConnectionFactory" class="com.ibm.mq.jms.MQConnectionFactory">
            <property name="transportType" value="${jms.transportType}" />
            <property name="hostName" value="${jms.hostName}" />
            <property name="port" value="${jms.port}" />
            <property name="channel" value="${jms.channel}" />
            <property name="SSLCipherSuite" value="${jms.ssl.cipherSuite}" />
            <property name="SSLSocketFactory" ref="sslSocketFactoryBean" />           
      </bean>

<!-- JMS Templates -->
    <bean id="JmsTemplate" class="org.springframework.jms.core.JmsTemplate"  abstract="true">
        <property name="connectionFactory" ref="jmsConnectionFactory" />
        <property name="sessionTransacted" value="true" />
    </bean>


Java Code:
=====================

Code:

jmsTemplate.convertAndSend((Object) msg, new MessagePostProcessor() {

                  public Message postProcessMessage(Message message)
                              throws JMSException {
                        m[0] = message;
                        return message;
                  }
            });


I am not sure how do I share the connection session between the different threads that will send the outgoing message.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » New session created when sending message using JMSTemplate
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.