可以以某种方式查看AMQ主题的内容吗? [英] Can the contents of an AMQ topic be viewed somehow?
问题描述
我正在尝试使用activemq-admin
查看主题的内容.
I'm trying to view the contents of a topic using activemq-admin
.
这是我正在尝试的:
./activemq-admin browse --amqurl tcp://localhost:61616 my.topic
这是我得到的输出:
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 ?
谢谢
推荐答案
由于主题的性质,您无法浏览主题的内容.发送消息,并且如果有任何订阅者,每个订阅者都会在该时间点接收到一条消息.消息通常不保留(这里有一些不相关的例外).
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>
然后您可以通过JMX或Web控制台浏览队列.
You can then browse the queue via JMX or the web console.
这篇关于可以以某种方式查看AMQ主题的内容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!