This question comes from here but can be a totally independent question.
I have a unit test with Spring 2.5.2 and activemq 5.2.0. I create a broker (useJmx is true) using "vm://localhost", fire a couple of messages to "myTopic1" open a jconsole to this process and I see MBeans under org.apache.activemq -> localhost -> Topic -> ActiveMQ.Advisory.Producer.Queue.myTopic1. This is the advisory topic (when a producer/consumer joins). But I don't see an MBean dedicated for the myTopic1 itself.
This does not seem to be the case when I run activemq seperately and use my Java program to connect to it. For ex, I downloaded ActiveMQ 5.2.0 altered the activemq.xml to use createConnector=true. I started the activeMQ sent a message to "myTopic1". I fired jconsole connected to using "localhost:1099" and I saw a JMX Bean under org.apache.activemq -> localhost -> Topic -> myTopic1 (In addition to the Advisory topic). This had attributes to tell me how many messages are fired.
Am I missing something here? Why is JMX beans different from vm://localhost (inbuilt broker creation) to the activemq server started locally ?
Apparently it was just me. The clue was in the "ActiveMQ.Advisory.Producer.Queue.myTopic1" JMX created above. I was using the following signature,
jmsTemplate.send("topic1", textMessage);
And now I know that Spring by default sends it to a QUEUE when we use a String destination name. So "topic1" was treated as a queue name (and not a topic). I altered the code as
Topic topic = //physically look up the topic
jmsTemplate.send(topic, textMessage);
and it works now.
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.