The following are examples of how to use Mule inside any JBI container. They provide configuration examples for each of the open source JBI containers.
File Binding
This reads a file from one directory 'inbox' and writes it to an 'outbox' directory. The example shows how it can be configured in Mule-JBI, ServiceMix and Celtix.
Mule JBI
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jbi-container PUBLIC "-//SymphonySoft //DTD mule-jbi-configuration XML V1.0//EN" "http://www.symphonysoft.com/dtds/mule/mule-jbi-configuration.dtd"> <jbi-container id="mule" xmlns:foo="http://www.mulejbi.org/foo/"> <!-- Mule Reciever that looks for files in the inbox directory --> <mule-component name="foo:fileReceiver" className="org.mule.providers.jbi.components.MuleReceiver"> <inbound-router> <endpoint address="file://./inbox?pollingFrequency=1000"/> </inbound-router> <outbound-router> <endpoint address="container://foo:fileSender"/> </outbound-router> </mule-component> <!-- Mule Dispatcher that Writes files to the outbox directory --> <mule-component name="foo:fileSender" className="org.mule.providers.jbi.components.MuleDispatcher"> <inbound-router> <endpoint address="container://foo:fileSender"/> </inbound-router> <outbound-router> <endpoint address="file://./outbox?outputPattern=$[MULE:ORIGINALNAME]"/> </outbound-router> </mule-component> </jbi-container>
ServiceMix
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns:mule="http://servicemix.org/mule/"> <!-- the JBI container --> <container id="jbi"> <property name="useMBeanServer" value="true"/> <property name="createMBeanServer" value="true"/> <property name="dumpStats" value="true"/> <property name="statsInterval" value="10"/> <components> <!-- Mule Reciever that looks for files in the inbox directory --> <component id="filePoller" service="foo:filePoller" class="org.mule.providers.jbi.components.MuleReceiver" destinationService="foo:fileSender"> <property name="workManager" ref="workManager"/> <property name="endpoint" value="file://./inbox?pollingFrequency=1000"/> <property name="targetServiceName" value="fileSender"/> </component> <!-- Mule Dispatcher that Writes files to the outbox directory --> <component id="fileSender" service="foo:fileSender" class="org.mule.providers.jbi.components.MuleDispatcher"> <property name="endpoint" value="file://./outbox?outputPattern=$[MULE:ORIGINALNAME]"/> </component> </components> </container> <!-- the work manager (thread pool) for this container --> <bean id="workManager" class="org.jencks.factory.WorkManagerFactoryBean"> <property name="threadPoolSize" value="30"/> </bean> </beans>