简体   繁体   中英

JMS Queue not receiving messages with ActiveMQ

So I have used Spring integration to link JMS and ActiveMQ as under:-

<amq:broker useJmx="false" persistent="false">
    <amq:transportConnectors>
        <amq:transportConnector uri="tcp://localhost:0" />
    </amq:transportConnectors>
</amq:broker>

<bean id="amqConnectionFactory"  class="org.apache.activemq.ActiveMQConnectionFactory"  p:brokerURL="tcp://localhost:61616"/>

<bean id="destination" class="org.apache.activemq.command.ActiveMQQueue" c:name="destination"/> 

<bean id="testTemplate" class="org.springframework.jms.core.JmsTemplate" depends-on="amqConnectionFactory" scope="prototype"
      p:connectionFactory-ref="amqConnectionFactory"
      p:pubSubDomain="false"
      p:defaultDestination-ref="destination"
      p:sessionTransacted="true"
      p:receiveTimeout="5000"/>

Now, when I run the test by starting ActiveMQ and then running my application, I see that the messages are published to the "destination" queue from the logs. However, I am not able to retrieve any of these from the queue. Even in JConsole, it shows the queueSize and counts as 0.

How do I make it work so that I can send to and receives messages from this queue? Please help.

Why do you specify the transport connector to: tcp://localhost:0 and the ConnectionFactory URL to tcp://localhost:61616 ?

I would use the same URL for both.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM