camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Münz <>
Subject Re: How to setup a dynamic route using beans in Java w/o having a spring ref to them?
Date Wed, 15 Dec 2010 17:10:09 GMT
Maybe the recipientList pattern is a solution for you in order to make 
your route dynamic.

Write the bean(s) you would like to call in the exchange header and 
that's it :)


MockEndpoint mockEndpoint = context.getEndpoint("mock:end", 
context.addRoutes(new SpringRouteBuilder() {
  public void configure() throws Exception {
     .recipientList(header("destinations"), ",");
// destinations is the header variable name
"testbody", "destinations", 

In this case it doesn't matter wheter the beans implements an interface 
or not. Just send the bean (and method if wished) you would like to call 
as a header variable.
The beans must be registered in spring's application context in your 
case or referenced by osgi reference tag like your description before.

Hope this helps...


klausb schrieb:
> Now I'm puzzled.
> Did you say, that a bean is identified by its interface only?
> How can I setup a route that uses different beans, where all beans implement
> the same interface?
> klaus.

View raw message