Creating a Servicemix Binding Component and using it

Here are the steps I followed to do this

Prerequisite

- A working knowledge of maven is a must
- Some knowledge of using Xbean is good ( not a must)

Creating a BC

1. Follow steps in http://servicemix.apache.org/hello-world-bc.html

mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-binding-component -DarchetypeVersion=3.3.2 -DgroupId=com.nsn.hiq -DartifactId=hello-world-bc

2.

http://markmail.org/message/gfxipkxic73fq2rg#query:+page:1+mid:keescdr6cm6g3hhc+state:results

3.

http://servicemix.396122.n5.nabble.com/Exception-on-hello-world-BC-sample-td415697.html

4.

http://www.mail-archive.com/users@servicemix.apache.org/msg02389.html
xmlns:hellobc="http://com.nsn.hiq/1.0"

Some tips

In MyProviderEndPoint class the Xbean annnotation marks the name of the provider endpoint
(which we will need later to use this component)

/**
* @org.apache.xbean.XBean element="provider"
*/
public class MyProviderEndpoint extends ProviderEndpoint implements MyEndpointType {

Similarly for the ConsumerEndPoint

/**
* @org.apache.xbean.XBean element="consumer"
*/
public class MyConsumerEndpoint extends ConsumerEndpoint implements MyEndpointType {

And also the component name

/**
* @org.apache.xbean.XBean element="component"
*/
public class MyComponent extends DefaultComponent {

------

Okay now how to create a SU that can call this BC.

Using maven created a simple SU and put this in the xbean.xml

xmlns:inmc="http://inmc.nsn.com/9.6"
xmlns:hellobc="http://com.nsn.hiq/1.0" >
endpoint="hellobc_endpoint" />
---
Now we can use a file poller to poll a folder

endpoint="endpoint"
targetService="test:eipcustombc"
file="d:\temp\_del\pollertest">

And in the EIP wire this to the the BC end point


And the send the output from our BC to a file sender

endpoint="endpoint"
autoCreateDirectory="true"
directory="d:\temp\_del\pollerOut_aggregate">

That all .