Monday, August 26, 2013

Spring DefaultMessageListenerContainer xml bean setting/configuration

    <bean id="cachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
        <property name="targetConnectionFactory" ref="emsFactory" />
          <property name="sessionCacheSize" value="${maximumSession}"/>
    </bean>

    <bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="destinationName" value="${receiveQueueName}" />
        <property name="connectionFactory" ref="cachingConnectionFactory" />
        <property name="messageListener" ref="mylistener" />
        <property name="maxConcurrentConsumers" value="${maximumListeners}" />
        <property name="autoStartup" value="true" />
    </bean>   

    <bean id="ctiSendDestination" class="com.tibco.tibjms.TibjmsTopic">
        <constructor-arg value="${sendTopic}"/>
    </bean>
   
    <bean id="mySender" class="my.test.MySender">
        <property name="jmsTemplate" ref="jmsTemplate" />
        <property name="destination" ref="ctiSendDestination" />
    </bean>
   
    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <constructor-arg ref="cachingConnectionFactory" />
    </bean>
   
    <bean id="emsFactory" class="com.tibco.tibjms.TibjmsConnectionFactory">
        <property name="serverUrl" value="${emsUrl}" />
        <property name="userName" value="${emsUser}" />
        <property name="userPassword" value="${emsPassword}" />
    </bean>
   
    <bean id="mylistener" class="my.test.Mylistener">
    </bean>

No comments: