Announcement Announcement Module
Collapse
No announcement yet.
How do I Autostart DefaultMessageListenerContainer? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I Autostart DefaultMessageListenerContainer?

    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.
    Last edited by markthegrea; Apr 4th, 2013, 10:29 AM. Reason: add info

  • #2
    Fixed this by taking out the DMLC and creating it outside the wrapper...

    Comment


    • #3
      Sorry - didn't see this earlier - yes inner beans are not registered, and don't participate in the context lifecycle.

      Comment

      Working...
      X