...
Maven users will need to add the following dependency to their pom.xml
for this component:
Code Block | ||||
---|---|---|---|---|
| ||||
<dependency> <groupId>org.apache-extras.camel<camel-extra</groupId> <artifactId>camel-zeromq</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency> |
URI format
Code Block |
---|
zeromq:(tcp|ipc)://hostname:port[?options]
|
...
To receive all messages from a publisher, and then print those to a logger:
Code Block |
---|
from("zeromq:tcp://127.0.0.1:5555").process(someLoggingProcessor);
|
To broadcast a message every second on three topics:
Code Block |
---|
from("timer://foo?fixedRate=true&period=10").process(new Processor() {
List<String> asList = Arrays.asList("coldplay", "keane", "jethro tull", "jack bruce", "elton john", "kate bush");
@Override
public void process(Exchange exchange) throws Exception {
Collections.shuffle(asList);
exchange.getIn().setBody(asList.get(0));
}
}).to("zeromq:tcp://127.0.0.1:5556?socketType=PUBLISH&topics=bands,musicians,singers");
|