Can the contents of an AMQ topic be viewed somehow?

本小妞迷上赌 提交于 2019-12-07 06:30:38

问题


I'm trying to view the contents of a topic using activemq-admin.

This is what I'm trying:

./activemq-admin browse --amqurl tcp://localhost:61616 my.topic

This is what I get as output:

Java Runtime: Sun Microsystems Inc. 1.6.0_24 /usr/lib/jvm/java-6-sun-1.6.0.24/jre
Heap sizes: current=62848k  free=62190k  max=932096k
JVM args: -Dactivemq.classpath=/home/pc/dev/apache-activemq-5.3.1/conf; -Dactivemq.home=/home/pc/dev/apache-activemq-5.3.1 -Dactivemq.base=/home/pc/dev/apache-activemq-5.3.1
ACTIVEMQ_HOME: /home/pc/dev/apache-activemq-5.3.1
ACTIVEMQ_BASE: /home/pc/dev/apache-activemq-5.3.1

Which is not what I want. I want to see the messages in the queue in raw form somehow. Is that possible ?

Thanks,


回答1:


You cannot browse the contents of topics due to the nature of what a topic is. Messages are sent in, and if there are any subscribers, each receives a message at that point in time. Messages are generally not retained (with some exceptions that aren't relevant here).

However, sometimes for debugging purposes it's useful to see messages that were sent to a topic. The easiest way to do so is to set up a virtual destination, that copies each message sent to the topic into a queue.

<destinationInterceptors>
    <virtualDestinationInterceptor>
        <virtualDestinations>
            <compositeTopic name="events" forwardOnly="false">
                <forwardTo>
                    <queue physicalName="events.thatHaveHappened" />
                </forwardTo>
            </compositeTopic>
        </virtualDestinations>
    </virtualDestinationInterceptor>
</destinationInterceptors>

You can then browse the queue via JMX or the web console.




回答2:


You can view the content of the messages in the Queue using the web console




回答3:


This third-party tool lets you subscribe to topics and inspect the messages to a topic:

http://sourceforge.net/projects/activemqbrowser/

Connect to the server, then subscribe to the topic you want. It worked OK for me to look at the message details and payloads.



来源:https://stackoverflow.com/questions/11226485/can-the-contents-of-an-amq-topic-be-viewed-somehow

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!