I am new to messaging overall but have landed up in a support project that makes heavy usage of messaging.
So the project uses Tibco and in Tibco - briding a topic to a queue is quite easy with the usage of a graphical UI .
Now we want to move to active mq - and have just started reading about it - am not finding a easy way to bridge a topic to queue(s)
any ideas ?
thanks
Depends a bit on what you mean by bridging. ActiveMQ has a couple of features that can help you out there.
Mirrored Queues . 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 queue Foo.Bar. Since its a topic as many consumers can subscribe to this topic as are required.
Virtual Topics Destinations : The idea behind virtual topics is that producers send to a topic in the usual JMS way. Consumers can continue to use the Topic semantics in the JMS specification. However if the topic is virtual, consumer can consume from a physical queue for a logical topic subscription, allowing many consumers to be running on many machines & threads to load balance the load.
Broker Camel Component : Embedding Apache Camel inside the ActiveMQ broker provides great flexibility for extending the message broker with the integration power of Camel. Apache Camel routes also benefit in that you can avoid the serialization and network costs of connecting to ActiveMQ remotely - if you use the activemq component.
Adding to the excellent answer of Tim Bish - you can also use composite destinations in the activemq xml configuration to explicitly forward messages from a topic to a queue. However, the easiest way is to use Virtual Topics, no config - simply naming conventions.
<destinationInterceptors>
<virtualDestinationInterceptor>
<virtualDestinations>
<compositeTopic name="THE.TOPIC">
<forwardTo>
<queue physicalName="THE.QUEUE" />
</forwardTo>
</compositeTopic>
</virtualDestinations>
</virtualDestinationInterceptor>
</destinationInterceptors>
To enable Mirrored Queues (see http://activemq.apache.org/mirrored-queues.html ), add the following inside the element of your XML Configuration:
<destinationInterceptors>
<mirroredQueue copyMessage = "true" postfix=".rec" prefix=""/>
</destinationInterceptors>
This would make a topic named "*.rec" for each queue on your Broker.
So every message put to Queue "Q1" would be also be sent to Topic "Q1.rec"
Virtual topic seems fitting for your need. Just
VirtualTopic.mytopic1
Consumer.<any string>.VirtualTopic.mytopic1
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.