Service Activator

Camel supports the Service Activator from the EIP patterns book.

How can an application design a service to be invoked both via various messaging technologies and via non-messaging techniques?

image

Design a Service Activator that connects the messages on the channel to the service being accessed.

Camel has several Components that support the Service Activator EIP.

Components like Bean and CXF provide a way to bind the message Exchange to a Java interface/service where the route defines the endpoints and wires it up to the bean.

In addition, you can use the Bean Integration to wire messages to a bean using Java annotation.

Example

Here is a simple example of using a Direct endpoint to create a messaging interface to a POJO Bean service.

  • Java

  • XML

from("direct:invokeMyService")
  .to("bean:myService");
<route>
  <from uri="direct:invokeMyService"/>
  <to uri="bean:myService"/>
</route>