...
Name | Default Value | Description |
---|---|---|
| | Camel 2.10: If used on the consumer side of the route, will filter events received from the |
Usage
Using guava-eventbus
jgroups
component on the consumer side of the route will capture messages sent to the Guava EventBus
received by the JChannel
associated with the endpoint and forward them to the Camel route. Guava EventBus JGroups consumer processes incoming messages asynchronously.
Code Block | ||||
---|---|---|---|---|
| ||||
SimpleRegistry registry = new SimpleRegistry(); EventBus eventBus = new EventBus(); registry.put("busName", eventBus); CamelContext camel = new DefaultCamelContext(registry); from("guava-eventbus:busName// Capture messages from cluster named // 'clusterName' and send them to Camel route. from("jgroups:clusterName").to("seda:queue"); eventBus.post("Send me to the SEDA queue."); |
Using guava-eventbus
jgroups
component on the producer side of the route will forward body of the Camel exchanges to the Guava EventBus
instance JChannel
instance managed by the endpoint.
Code Block | ||||
---|---|---|---|---|
| ||||
SimpleRegistry// registrySend =message new SimpleRegistry(); EventBus eventBus = new EventBus(); registry.put("busName", eventBus); CamelContext camel = new DefaultCamelContext(registry); to the cluster named 'clusterName' from("direct:start").to("guava-eventbusjgroups:busName"); ProducerTemplate producerTemplate = camel.createProducerTemplate(); producer.sendBody("direct:start", "Send me to the Guava EventBus."); eventBus.register(new Object(){ @Subscribe public void messageHander(String message) { System.out.println("Message received from the Camel: " + message); } }clusterName"); |