镜像队列
http://activemq.apache.org/mirrored-queues.html
?
?
? ? ? ? ? ? ? ? ? ?Mirrored Queues
----------------------------------
? 镜像队列
?
? Queues provide an excellent reliable and high performance load balancing mechanism. Each message placed on a queue can only be successfully processed by a single?
? 队列提供杰出可靠和高性能的负载机制。 每一个置于队列的消息都只能被成功的消费一次被唯一的消费者。这是好事! 然而有时候我们需要去监视一个消息从生产者到消费者的流向是咋样的
? consumer。This is a good thing! ?sometimes you want to monitor what messages flow between the producers and consumers on a queue.
?
??
?
?
? To do this you can use Virtual Destinations to setup a virtual Queue which forwards the message to multiple physical queues. However enabling this for every?
? 你能使用虚拟目的地 设置一个虚拟队列(一个消息发往多个物理队列) ,然而为每一个队列提供这个功能非常繁琐
? single queue in your system can be painful.
??
?
? So to make it easy to monitor queues, we have added a feature we call Mirrored Queues. Mirrored Queues are kinda like a zero-configuration Wire Tap on all of?
? 为了让监控队列比较容易,我们添加了镜像队列这个特性。镜像队列有点像是一个为实例上的所有队列都添加了一个零配置的Wire Tap。
? your queues inside your Message Broker.
?
?
? Example
? ----------------------------------
?
? ? ? For example imagine we have a number of producers sending to queue Foo.Bar and consumers consuming from queue Foo.Bar and we want to monitor or view activity.
? ? ? ? ? ? ? ? ? ? ? ? 想像我们有许多生产者往队列Foo.Bar 发送消息 消费者持续取从Foo.Bar取消息. ?我们想监控或者观察内部活动
? ? ??
? ? ? If you enable Mirrored Queues then by default you can subscribe to the topic VirtualTopic.Mirror.Foo.Bar and receive all the messages that are sent to the?
? ? ? ? ? 如果你开启了镜像队列,默认你能订阅主题VirtualTopic.Mirror.Foo.Bar,然后你能收到所有发往队列Foo.Bar的消息 ,就像一个主题能被许多需要的消费者所订阅.
? ? ? queue Foo.Bar. Since its a topic as many consumers can subscribe to this topic as are required.?
? ? ??
?
? ? ? If you want you can use this feature with Virtual Topics; so that you can define a logical consumer; say called A. Then you can subscribe to the queue?
? ? ? 如果你愿意你能借助虚拟队列使用它;你能定义一个逻辑消费者,我们叫他A吧。然后你能订阅Consumer.A.VirtualTopic.Mirror.Foo.Bar这个队列去接收所有发往Foo.Bar的消息.
? ? ? Consumer.A.VirtualTopic.Mirror.Foo.Bar to receive all the messages sent to queue Foo.Bar for the consumer A. You can then run multiple instances of this?
? ? ? 你能运行这个消费者的多个实例去接收他以至于彼此均衡
? ? ? consumer who can then load balance among each other.
?
? ? ? This combination of Mirrored Queues and Virtual Destinations can be extremely useful for monitoring transaction flows; for example with Business Activity?
? ? ? ? 镜像队列与虚拟目的的组合能及其有用的监控事务; 如商业活动监控
? ? ? Monitoring (BAM).
?
? How Mirrored Queues work
?
? --------------------------------
?
? ? ?When enabled, mirrored queues causes every message sent to a queue to also be sent to a topic of a similar name; so that folks who are interested in watching?
? ? ?当你开启镜像队列时,镜像队列可以使每个发往一个队列的消息,同时发送到一个类似名字的TOPIC中. ?那些对队列传输期间消息交换感兴趣的人可以消费者这个虚拟队列主题
? ? ?message exchanges on a queue can consume from the mirrored queue topic.
?
?
? ? ?When coupled with Virtual Topics on this topic as described in the above example, you can actually end up creating new queues which are mirrors of a given
? ? ?当成对的像上面描述的虚拟主题,你能创建多动态的的镜像队列在运行时作为结束
? ? ? queue dynamically at runtime!
?
?
?
? Enabling Mirrored Queues
?
? -------------------------------
?
? ? ?By default Mirrored Queues is disabled; as enabling it will cause a virtual topic to be created for each queue you use.
? ? ?
? ? ?默认情况下,镜像队列是关闭的。如果开启的话,将会为你使用的每一个队列创建一个虚拟主题.
?
? ? ?To enable Mirrored Queues, set the useMirroredQueues property on BrokerService or add the following inside the <broker> element in the
?
? ? ? Xml Configuration:
? ? ? ? <mirroredQueue copyMessage = "true" postfix=".qmirror" prefix=""/>
? ? ? ? </destinationInterceptors>
?
? ? ?This would make a topic named "*.qmirror" for each queue on your Broker.