camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <>
Subject Re: Abstracting Routes using Components
Date Tue, 26 Oct 2010 15:31:36 GMT
On 26 October 2010 16:17, Hadrian Zbarcea <> wrote:
> So the idea is to use route templates and in order to parameterized them use URIs the
camel way. That's nice and consistent.

There are a few different options here...

i) a parameterized RouteBuilder which can be dependency injected using

ii) a parameterized RouteBuilder which is dependency injected using a
URI (which is kinda like Kristof's example code)

iii) a ProtocolBuilder which is-a Component and is-a RouteBuilder so
that the components URI namespace can be used to export 'global names'
to its logical endpoints which map to internal Camel endpoints names
used inside the routes. The ProtocolBuilder could even use a nested
internal CamelContext to totally hide the implementation detail. Which
is what I describe here...

This idea would let a default Protocol have default endpoints "in",
"out" and "err" for example.

Each of these approaches have their own strengths and weaknesses,
depending on what you are doing and if you need to 'wrap' or 'hide'
implementation details or if you just want simple parameterization of
a RouteBuilder class. If all you want is parametrization of a
RouteBuilder then (i) or (ii) works great; just pick your preferred
injection mechanism.

(iii) is subtly different; its like taking some integration code as an
implementation and packaging it up with a public interface for others
to use inside other routes; hiding the implementation detail from the
person doing the integration of this new component. With the customers
I've talked to where (iii) is more relevant they have one team making
a particular Protocol (a component which wraps a bunch of routing
rules), then they have other teams take the various Protocols output
by other teams and route them together.

In this sense the Protocols become just a way to package up a
collection of Routes into an easy to use form for others folks to use;
rather like using Composition with Object Orientation to make an easy
to use Facade on top of some implementation code.

Twitter: jstrachan

Open Source Integration

View raw message