Announcement Announcement Module
Collapse
No announcement yet.
DefaultMessageListenerContainer & ActiveMQ Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DefaultMessageListenerContainer & ActiveMQ

    I am having a strange problem running with Spring 2.5.1 & ActiveMQ 5.1 - running on Tomcat,

    I have one jar that is contains both producer & consumers for the same ActiveMQ destination. I include this in two separate applications. In one, it starts correctly and I can see both producer & consumer being set up and initialized correctly. However, in another, the consumer class was not registered. This behaviour occurs whether the second application is the only one running or when running with the first.

    I debugged this to the point where I have identified the cause, - in the failed application when the DefaultMessageListenerContainer is being constructed, it is not being recognized as an InitializinfBean. This means its afterPropertiesSet operation is not called and so no consumer is wired up.

    I can't see why the DefaultMessageListenerContainer class would have this behaviour. Any suggestions?


    Here is the related configuration


    <bean id="jmsFactory" class="org.apache.activemq.ActiveMQConnectionFacto ry">
    <property name="brokerURL" value="${testjms.brokerurl}"/>
    </bean>

    <bean id="pooledJmsFactory" class="org.apache.activemq.pool.PooledConnectionFa ctory" destroy-method="stop">
    <property name="connectionFactory">
    <ref local="jmsFactory"/>
    </property>
    </bean>

    <bean id="testDestination" class="org.apache.activemq.command.ActiveMQTopic" autowire="constructor">
    <constructor-arg value="testDestination" />
    </bean>

    <bean id="inventoryRequestListenerContainer" class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
    <property name="connectionFactory" ref="jmsFactory"/>
    <property name="destination" ref="testDestination"/>
    <property name="messageListener" ref="testMessageListenerAdapter"/>
    </bean>

    <bean id="testMessageListenerAdapter" class="org.springframework.jms.listener.adapter.Me ssageListenerAdapter">
    <property name="delegate" ref="testRequestMessageConsumer"/>
    <property name="defaultListenerMethod" value="handleMessage"/>
    <property name="messageConverter" ref="testEventMessageConverter"/>
    </bean>

    <bean id="testRequestMessageConsumer" class="org.dummy.JmsReportScanScheduleConsumer">
    <property name="reportScanScheduleChangeService" ref="reportScanScheduleChangeConsumer"/>
    </bean>

    <bean id="testEventMessageConverter" class="org.dummy.EventMessageConverter"/>

    <bean id="reportScanScheduleChangeConsumer"
    class="org.dummy.ReportScanScheduleChangeConsumer"
    init-method="init">
    </bean>

    <bean id="testRequestJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="pooledJmsFactory"/>
    <property name="defaultDestination" ref="testDestination"/>
    <property name="pubSubDomain" value="false"/>
    <property name="messageConverter" ref="testEventMessageConverter"/>
    </bean>

    <bean id="inventoryService" class="org.dummy.InventoryService">
    <property name="reportScanScheduleChangeService" ref="${test.notificationService}"/>
    </bean>

    <bean id="testEventMessageProducer" class="org.dummy.JmsReportScanScheduleProducer">
    <property name="connectionFactory" ref="pooledJmsFactory"/>
    <property name="jmsTemplate" ref="testRequestJmsTemplate"/>
    </bean>
Working...
X