...
Wiki Markup |
---|
{snippet:id=example|lang=xml|url=http://svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix-components/src/test/resources/org/apache/servicemix/components/pojo/example.xml} |
Now lets look at the sender POJO. The sendMessages() method will send messages onto the JBI bus to the destination service specified in the above XML.
Wiki Markup |
---|
{snippet:id=send|lang=java|url=http://svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix-components/src/test/java/org/apache/servicemix/components/pojo/MySender.java} |
Then the receiver processes inbound messages as follows.
Wiki Markup |
---|
{snippet:id=receive|lang=java|url=http://svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix-components/src/test/java/org/apache/servicemix/components/pojo/MyReceiver.java} |
Being even more POJO
The code above may seem a bit too verbose for you. Firstly you can reduce much code by reusing the Component helper classes.
...
Wiki Markup |
---|
{snippet:id=send|lang=java|url=http://svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix-components/src/test/java/org/apache/servicemix/components/pojo/PojoSender.java} |
And this is a POJO receiver which just consumes the messages its given, without explicitly implementing the component or lifecycle interfaces
Wiki Markup |
---|
{snippet:id=receive|lang=java|url=http://svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix-components/src/test/java/org/apache/servicemix/components/pojo/PojoReceiver.java} |