Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Finished JGroups documentation

...

Name

Default Value

Description

eventClass channelProperties

null

Camel 2.10: If used on the consumer side of the route, will filter events received from the EventBus to the instances of the class and superclasses of eventClass. Null value of this option is equal to setting it to the java.lang.Object i.e. the consumer will capture all messages incoming to the event bus. Specifies configuration properties of the JChannel used by the endpoint.

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
java
java
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
java
java
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");