jstrachan wrote: > > On 6 October 2010 13:02, Olivier.Roger <olivier.ro...@bsb.com> 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? > >
I was thinking I could use a properties file and using the Config Admin service from SMX I could change the values at runtime. jstrachan wrote: > > 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 > > > I just read the page from the book again and it seems to be a better way indeed, even if it might a bit overkill in this situation. Is there already a component in Camel that could provides such functionalities ? I haven't seen anything like that since now. jstrachan wrote: > > >> 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? > > > The idea was to provide default routes that could be extended by other teams for specific (client) needs. Those routes would just have to start from hook-in and end at hook-out which is really easy. And configuration is quite simple to start using that new route. (simply match default.hook-in to specific.hook-in and same for out). -- View this message in context: http://camel.465427.n5.nabble.com/Hookpoint-Extensible-routes-tp3201249p3204772.html Sent from the Camel - Users mailing list archive at Nabble.com.