treefrog
treefrog

Reputation: 1057

Multiple camelcontexts in one osgi module - what to be careful about?

The application has several camel contexts, each doing its own thing and as such do not need to communicate with each other. They are in the same module because they share some classes.

Are there any issues one needs to watch out for in the case of multiple contexts in a single osgi module ?

What is the recommendation and best-practice in this case ?

Upvotes: 0

Views: 144

Answers (2)

Alessandro Da Rugna
Alessandro Da Rugna

Reputation: 4695

One single recommendation: have stateless beans/processors/aggregators.

All the state related information about the processing of your body must live in the Exchange headers/properties.

static final constants are good.
Configuration read only properties are fine too.

Upvotes: 1

Matt Pavlovich
Matt Pavlovich

Reputation: 4306

It is fairly subjective. IMHO: The two big things to consider are process control and upgrade impacts. Remember-- during a bundle upgrade all the contexts will stop and then restart.

You still have the ability to do fine grain process control (start, stop, pause, resume) at the Camel Context and Route level without having to rely on bundle start | stop.

If you wanted fine grain upgrade ability, you could put the Java classes in their own bundle, export the packages. Then put Camel Contexts in their own bundles and import the Java classes from the shared bundle. You then have the ability to do individual upgrades of the Camel Contexts w/o having to upgrade all the Contexts at once (and force them all to stop).

Upvotes: 3

Related Questions