Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This means you can write JBI POJOs to be deployed by Spring without deriving from some helper base class like ServiceMix's ComponentSupport so that your POJO has no dependency other than on the JBI APIs and then let ServiceMix take care of more of the plumbing for you.

Example POJO Components

First here's how we configure the two components in ServiceMix. Notice that ServiceMix is doing the routing here using destinationService.

...

Wiki Markup
{snippet:id=receive|lang=java|url=http://cvs.servicemix.codehaus.org/*checkout*/servicemix/base/src/test/java/org/servicemix/components/pojo/MyReceiver.java?rev=HEAD}

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.

Another option is to be even more POJO-like. If you just want to invoke operations on the JBI bus then there's no need for you to implement the JBI component or lifecyclce contract - you can just reuse the Client API.

For example this POJO sends messages into the JBI bus.

Wiki Markup
{snippet:id=send|lang=java|url=http://cvs.servicemix.codehaus.org/*checkout*/servicemix/base/src/test/java/org/servicemix/components/pojo/PojoSender.java?rev=HEAD}

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://cvs.servicemix.codehaus.org/*checkout*/servicemix/base/src/test/java/org/servicemix/components/pojo/PojoReceiver.java?rev=HEAD}