Results 1 to 3 of 3

Thread: DefaultMessageListener not receving messages

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Posts
    18

    Default DefaultMessageListener not receving messages

    Hi,

    I have some problem using a MDP and activemq. I have set up a ListeningContainer that I start in a standalone process and I can send messages to the queue that I'm listening to from another process (using a jmsTemplate). However my MDP never receives any messages...

    My beans.xml (leaving out hibernate config)
    <contextroperty-placeholder
    location="classpath:jdbc.properties,amq.properties " />

    <!-- this is the Message Driven POJO (MDP) -->
    <bean id="messageListener"
    class="no.ergo.online.push.jms.JmsMessageListener" />

    <!-- and this is the message listener container -->
    <bean id="jmsContainer"
    class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
    <property name="connectionFactory" ref="jmsFactory" />
    <property name="destination" ref="destination" />
    <property name="messageListener" ref="messageListener" />
    <property name="sessionTransacted" value="true" />
    </bean>

    <bean id="messageBroadcaster"
    class="no.ergo.online.push.jms.JmsMessageBroadcast er">
    <property name="jmsTemplate" ref="jmsTemplate" />
    </bean>

    <bean id="messageConverter"
    class="no.ergo.online.push.TextMessageConverter" />

    <bean id="jmsTemplate"
    class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="jmsFactory" />
    <property name="messageConverter" ref="messageConverter" />
    <property name="defaultDestination" ref="topic" />
    </bean>

    <!-- JMS ConnectionFactory to use, configuring the embedded broker using XML -->
    <amq:connectionFactory id="jmsFactory"
    brokerURL="${amq.broker.url}">
    <amqrefetchPolicy>
    <amqrefetchPolicy queuePrefetch="1" topicPrefetch="1" />
    </amqrefetchPolicy>

    </amq:connectionFactory>

    <!-- lets create an embedded ActiveMQ Broker -->
    <amq:broker useJmx="true" persistent="false">
    <amq:managementContext>
    <amq:managementContext connectorPort="9876" />
    </amq:managementContext>

    <amq:transportConnectors>
    <amq:transportConnector uri="${amq.broker.url}" />
    </amq:transportConnectors>
    </amq:broker>

    <!-- ActiveMQ destinations to use -->
    <amq:queue id="destination" physicalName="${online.incoming.queue}" />

    <amq:topic id="topic" physicalName="${online.outgoing.topic}" />

    And my amq.properties file referenced from beans.xml:
    amq.broker.url=tcp://localhost:61616
    online.incoming.queue=fraAlystra
    online.outgoing.topic=tilOnlineTopic

    And output from browsing the queue:
    D:\dev\apache-activemq-4.1.2\bin>browse --amqurl tcp://localhost:61616 fraAlystra
    ACTIVEMQ_HOME: D:\dev
    ACTIVEMQ_BASE: D:\dev
    JMS_CUSTOM_FIELD:id = 12345qwerty
    JMS_CUSTOM_FIELD:userName = someUser
    JMS_HEADER_FIELD:JMSDestination = fraAlystra
    JMS_BODY_FIELD:JMSText = <?xml version="1.0" encoding="ISO-8859-1"?><GetStoplistMessage xmlns="http://www.transware.se/server/services/integration/box/messages"
    ><unitInfo><unit>271217</unit><pdaId/><driverId>LN</driverId></unitInfo><messageInfo><messageDate>2007-02-21T11:49:43.917+0100</messageDate><sessionId>271217_20
    07-02-21T11:48:14.635+0100_K6957</sessionId><messageId></messageId><correlationId></correlationId></messageInfo><stoplistVersion>0</stoplistVersion></GetStoplis
    tMessage>
    JMS_HEADER_FIELD:JMSDeliveryMode = persistent
    JMS_HEADER_FIELD:JMSMessageID = ID:eg8573-3488-1211208060999-1:0:1:1:1
    JMS_CUSTOM_FIELD:source = Alystra-Box
    JMS_HEADER_FIELD:JMSExpiration = 0
    JMS_HEADER_FIELD:JMSPriority = 4
    JMS_HEADER_FIELD:JMSRedelivered = false
    JMS_CUSTOM_FIELD:ttl = 2008-05-19 16:40:59.874
    JMS_HEADER_FIELD:JMSTimestamp = 1211208061280

  2. #2
    Join Date
    Jan 2006
    Posts
    18

    Default

    I've testerd a little bit more and checked that I can put messages on and activemq queue and receive messages off the queue using the standard Jmsapi. So my activemq setup seems to be OK...
    But still no luck with Springs MDP and DefaultMessageListenerContainer. So far as I can see my springconfig is the same as in the documentantation so I really don't understand why it's not working.

  3. #3
    Join Date
    Jan 2006
    Posts
    18

    Default Schema based config not working properly?

    After a lot of fiddeling with spring config I've finally found a config that makes the DefaultMessageListenerContainer work.


    <!-- and this is the message listener container -->
    <bean id="listenerContainer"
    class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
    <property name="connectionFactory" ref="jmsFactory" />
    <property name="destinationName"
    value="${online.incoming.queue}" />
    <property name="messageListener" ref="messageListener" />
    <property name="sessionTransacted" value="true" />
    <property name="concurrentConsumers" value="5" />
    </bean>
    <bean id="jmsFactory"
    class="org.apache.activemq.pool.PooledConnectionFa ctory"
    depends-on="hibernateTemplate, broker">
    <property name="connectionFactory">
    <bean
    class="org.apache.activemq.ActiveMQConnectionFacto ry">
    <property name="brokerURL" value="${amq.broker.url}" />
    </bean>
    </property>
    </bean>

    <bean id="broker"
    class="org.apache.activemq.xbean.BrokerFactoryBean ">
    <property name="config" value="classpath:activemq.xml" />
    <property name="start" value="true" />
    </bean>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •