camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <james.strac...@gmail.com>
Subject Re: Abstracting Routes using Components
Date Tue, 26 Oct 2010 16:00:41 GMT
On 26 October 2010 16:40, Ashwin Karpe <akarpe@fusesource.com> wrote:
>
> Hi Hadrian,
>
> Not sure if you recall, but we had discussed a similar idea about 8-10
> months ago when I was on a consulting gig where we were trying to do
> something similar (not exactly components, but black boxed subroutes) so
> that we could do something like
>
>     from(route:blackboxedroute1)
>        .to(route:blackboxedroute2);
>
> where "route:..." was a pointer to an encapsulated route and would
> instantiate the route on demand.

BTW thats kinda the code Kristof submitted at the start of this thread
if you take a look. Thats a totally valid approach too BTW.

For this approach you suggest we need to expose the RouteBuilder as a
named bean so the "route:" component can refer to it, right? So the
endpoint "route:foo" refers to the "foo" RouteBuilder.

The thing is a typical RouteBuilder might have many inputs and
outputs; you typically want to be able to route to some of the
endpoints inside some of the routes and from some of the endpoints. So
how does this route: component know what endpoints are inside the
black box RouteBuilder?

So we're often not wrapping up a set of routes as a 'single endpoint'
- but instead as a black box with a number of endpoints (say one "in"
and an "out" and "err"). Or maybe multiple in and outs?


This was why I suggested the ProtocolBuilder; let lets you take a
RouteBuilder and turn it into a Component and provide a way of
converting simple component relative endpoint URIs to actual
implementation endpoints. e.g. using your example Ashwin...

  from("blackboxroute1://out").to("backboxroute2://in")

Then in the ProtocolBuilder class, we do the normal RouteBuilder
stuff, but also map some input/output names ("in", "out", "error" for
example) to the actual physical endpoint URIs the routes are using.

The only difference really between the 'generic route component' and
the ProtocolBuilder I'm proposing is the latter provides a simpler
endpoint naming approach and can deal with an arbitrary number of
input and output endpoints. Plus I'm not quite sure how the former
works when a RouteBuilder defines many inputs and outputs :)

Maybe the "route proxy component" is good when you want to turn a
RouteBuilder into a single Camel endpoint. The ProtocolBuilder is good
when you want to turn a RouteBuilder into a number of named input &
output endpoints - or when you want a simpler URI?

-- 
James
-------
FuseSource
Email: james@fusesource.com
Web: http://fusesource.com
Twitter: jstrachan
Blog: http://macstrac.blogspot.com/

Open Source Integration

Mime
View raw message