Quantcast
Channel: Spring Community Forums - JMS
Viewing all articles
Browse latest Browse all 51

How do I Autostart DefaultMessageListenerContainer?

$
0
0
I am attempting to autostart my DMLC. In another app we do it fine, but this one must be different. My configuration is below. I am attempting to set "autoStartup" but that does not seem to work.

Am I wrong in assuming this is the way to autostart after a jvm reboot? I can use a servlet or Task. How do you guys do it?

Code:

<!-- This hooks us up to the jndi -->
        <jee:jndi-lookup id="telematicsJNDIConnectionFactory" jndi-name="${mq.jndi}" cache="true" lookup-on-startup="true" />
        <!-- The outer wrapper must be TransactionAware, the inner custom one will cache the connection -->
        <bean id="telematicsConnectionFactory" class="org.springframework.jms.connection.TransactionAwareConnectionFactoryProxy">
                <property name="targetConnectionFactory">
                        <bean class="dds.tmatic.utils.CustomConnectionFactory">
                                <property name="targetConnectionFactory">
                                        <ref bean="telematicsJNDIConnectionFactory" />
                                </property>
                                <property name="username">
                                        <value>${mq.user}</value>
                                </property>
                                <property name="password">
                                        <value>${mq.pass}</value>
                                </property>
                                <property name="sessionCacheSize">
                                        <value>10</value>
                                </property>
                        </bean>
                </property>
                <property name="synchedLocalTransactionAllowed" value="true" />
        </bean>
       

        <!-- this is the class that will be kicked off when a message hits the q -->
        <bean id="telematicsMessageListener" class="dds.tmatic.service.TMaticListener" />

        <!-- This is the listener that kicks off messages when they hit the q -->
        <bean id="telematicsListenerContainer" class="dds.tmatic.service.TMaticListenerContainerImpl">
                <constructor-arg index="0">
                        <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
                                <property name="connectionFactory" ref="telematicsConnectionFactory" />
                                <property name="destinationName" value="${mq.name}" />
                                <property name="messageListener" ref="telematicsMessageListener" />
                                <property name="maxConcurrentConsumers" value="${mq.maxcc}" />
                                <property name="concurrentConsumers" value="${mq.cc}" />
                                <property name="sessionTransacted" value="true" />
                                <property name="autoStartup" value="${mq.strt}" />
                                <property name="cacheLevelName" value="CACHE_CONNECTION" />
                        </bean>
                </constructor-arg>
        </bean>

We are using Spring 3.0.6.

Viewing all articles
Browse latest Browse all 51

Trending Articles