On 6 October 2010 13:02, Olivier.Roger <[email protected]> wrote:
> Hello Camel!
>
> I was wondering how routes could be extensible.
>
> I thougth I could use the following idea to do it but I appears to be
> otherwise:
>
> The route I created is pretty simple: It picks up message from A, transform
> it then send it to B.
> I would like to make it extensible so that another route could be hooked
> into it.
>
> My idea was to divide the route into 2 routes:
>
> 1) A -> transform -> properties:hook-in
> 2) properties:hook-out -> B
>
> By default hook-in and hook-out would use the same direct:hook endpoint or
> anything like that.
>
> If another route transporting messages from C to D needs to be added, the
> properties can be changed to
> - hook-in=C
> - hook-out=D
> That way the route would be complete.
This sounds a bit like using a class with fields for the endpoints?
class MyRoute extends RouteBuilder {
public String hookIn = "direct://in";
public String hookOut = "direct://out";
protected void configure() {
from("activemq:A").to(hookIn);
from(hookOut).to("activemq:B");
}
then you just configure the MyRoute instance with specific values of
hookIn/hookOut?
Another option is to introduce a special kind of endpoint which
basically is just a proxy which resolves itself at runtime using some
mechanism; which you can then modify at runtime or use some registry
or Map to decide which names map to what physical endpoints. Kinda
like the Control Bus pattern
http://www.enterpriseintegrationpatterns.com/ControlBus.html
> However, since I deploy the route as separate osgi bundles (one with A->B,
> another with C->D), I get the following error
>
> CamelExchangeException: No consumers available on endpoint:
> Endpoint[direct://hook-in]
>
> Another complication is that I would like the route to stay transactional
> and only have A and B persisted on my JMS broker.
>
> Is that possible ?
You do realise that having a direct: or vm: endpoint in between two
JMS endpoints basically breaks all reliability you have; your route
may be transactional but if the JVM processing the route goes down you
stand to lose possibly many messages which were sat in memory on the
direct/vm buffer.
Why do you explicitly not want to add a persistence step? Might it be
better to miss out the C and D steps, and just do one transaction from
A to B (with whatever other things you want) then you get reliability,
transactions and persistence?
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/