Publish Subscribe Channel
How can the sender broadcast an event to all interested receivers?
Send the event on a Publish-Subscribe Channel, which delivers a copy of a particular event to each receiver.
The Publish-Subscribe Channel is supported in Camel by messaging based Components, such as:
There are also messaging based in the cloud from cloud providers such as Amazon, Google and Azure.
|See also the related Point to Point Channel EIP|
The following example demonstrates publish sbuscriber messaging using the JMS component with JMS topics:
from("direct:start") .to("jms:topic:cheese"); from("jms:topic:cheese") .to("bean:foo"); from("jms:topic:cheese") .to("bean:bar");
And in XML:
<routes> <route> <from uri="direct:start"/> <to uri="jms:queue:foo"/> </route> <route> <from uri="jms:queue:foo"/> <to uri="bean:foo"/> </route> </routes>