Extend ServiceMix Management features using Spring – Part 1

Prologue
This is the first from a series of posts that demonstrate how to extend ServiceMix management using Spring’s jmx and aop features. The version of SerivceMix that is going to be used will be 3.3.3-SNAPSHOT but I’ve been using this technique since 3.3 and it will probably can be applied to 4.x.

Problem
One of the most common problems I had with servicemix was that even the most simple changes in the configuration _(e.g. changing the name of the destination in a jms endpoint)  _required editing the xbean.xml of the service unit and redeployment. Moreover this affected the rest of the service units contained in the service assemblies, which would be restarted too.

An other common problem was that I could not start, stop and restart a single service unit. That was a major problem since I often needed to be able to stop sending messages, while being able to accept messages in the bus. The only option I had was to split our service units in multiple service units (e.g. inbound service unit and outbound service unit).

Solution
This series of blog post will demonstrate how we used spring in order to:

  1. Obtain service unit lifecycle management via jmx.
  2. Expose endpoint and marshaler configuration via jmx.
  3. Perform configuration changes on live production environements.
  4. Persisting these changes to database.
  5. Loading endpoint custom configuration from database.