| h1. servicemix-bean |
| |
| h2. Overview |
| The ServiceMix Bean component provides integration with beans (POJOs) with the JBI bus to make it easy to use POJOs to process JBI message exchanges. Like in an Message Driven Bean in J2EE a POJO will receive a message from the NMR and process it in any way it likes. Unlike in a JMS component where the coding is already done the Bean component gives the developer the freedom to create any type of message handling but it must be hand coded all the way. |
| |
| h3. Namespace and xbean.xml |
| The namespace URI for the servicemix-bean JBI component is {{http://servicemix.apache.org/bean/1.0}}. This is an example of <filename>xbean.xml</filename> file with a namespace definition with prefix {{bean}}. |
| {code} |
| <beans xmlns:bean="http://servicemix.apache.org/bean/1.0"> |
| |
| <!-- add bean:endpoint definitions here --> |
| |
| </beans> |
| {code} |
| |
| h3. Endpoint types |
| The servicemix-bean component only defines one endpoint, called {{bean:endpoint}}. It can be used to receive and send message exchanges from/to the NMR. |
| |
| h2. {{Endpoint bean:endpoint}} |
| |
| h3. Using a Java class |
| When definining a {{bean:endpoint}} specifying a Java class name, a new instance of this class will be created for handling a single message exchange. |
| |
| {code} |
| <beans xmlns:bean="http://servicemix.apache.org/bean/1.0" |
| xmlns:my="urn:org:servicmix:docs:examples"> |
| |
| <bean:endpoint service="my:service" endpoint="endpoint" |
| class="org.apache.servicemix.docs.bean.MyHandlerBean"/> |
| |
| </beans> |
| {code} |
| |
| h3. TODO: add other configuration types |