Available as of Camel 2.4
The ejb: component binds EJBs to Camel message exchanges.
Maven users will need to add the following dependency to their pom.xml for this component:
Where ejbName can be any string which is used to look up the EJB in the Application Server JNDI Registry
You can append query options to the URI in the following format, ?option=value&option=value&...
How bean methods to be invoked are chosen (if they are not specified explicitly through the method parameter) and how parameter values are constructed from the Message are all defined by the Bean Binding mechanism which is used throughout all of the various Bean Integration mechanisms in Camel.
In the following examples we use the Greater EJB which is defined as follows:
And the implementation
In this example we want to invoke the hello method on the EJB. Since this example is based on an unit test using Apache OpenEJB we have to set a JndiContext on the EJB component with the OpenEJB settings.
Then we are ready to use the EJB in the Camel route:
And this is the same example using Spring XML instead:
Again since this is based on an unit test we need to setup the EJB component:
Before we are ready to use EJB in the Camel routes: