Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the asciidoc in the repository: https://github.com/apache/camel/blob/master/README.md https://github.com/apache/camel/blob/master/components/readme.adoc
Camel ZeroMQ Component
Available as of Camel 2.11
The camel-zeromq component is provided by the Camel Extra project which hosts *GPL related components for Camel.
The camel-zeromq component allows you to consumer or produce messages using ZeroMQ. Zeromq requires a bit of work to get setup, especially on windows. Refer to the documentation. Note: This component works with the stable 2.2 branch and not the pre-release 3.2.
This component uses Akka for it's Zeromq "driver" but does not use Scala Actors. This means the component does not require the JZMQ libraries to be built and present, just the native ZeroMQ library that is installed when you build ZeroMQ on your system. There is some discussion as to the speed of the Akka driver, and so it is possible to switch to using the JZMQ driver if you wish. Simply remove the Akka Zeromq dependancy and replace it with the JZMQ jar and ensure the zmq.lib is present on your system. For more information see here.
Maven users will need to add the following dependency to their
Where hostname is the hostname or ip where the server will run.
The follwing headers are set on exchanges during message transport.
ZeroMQ sends its messages as a byte stream and so incoming messages have the body set as a byte array. When sending to a producer, the messageConvertor is invoked, and passed the Exchange. The DefaultMessageConvertor will return the body as is, if it is a byte array, otherwise it will call toString().getBytes(). You can provide custom conversion strategies by specifying a class to the messageConvertor option on the endpoint.
To receive all messages from a publisher, and then print those to a logger:
To broadcast a message every second on three topics: