Hi, I've a problem calling a REST based service with dynamic uris in combination with a failover load balancer. Below is how I do it at the moment but I'm open to better solutions. It would also be great if there is a way that I can inject a dynamic number of endpoints, so I could inject a thrid cluster node without changing the code.
I've designed the route as from("direct:a") .loadBalance() .failover(-1, false, false) .recipientList(simple(endpoints[0])) .recipientList(simple(endpoints[1])) .end() Which leads to this exception: Caused by: java.lang.ClassCastException: org.apache.camel.model.LoadBalanceDefinition cannot be cast to org.apache.camel.model.ExpressionNode at com.sbo.MyRouteBuilder.configure(QuovaRouteBuilder.java:52) at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322) at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:276) at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:262) at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:650) at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.installRoutes(AbstractCamelContextFactoryBean.java:658) at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCamelContextFactoryBean.java:282) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479) ... 50 more If I change the route to from("direct:a") .loadBalance() .failover(-1, false, false) .process(new RecipientList(getContext(), simple(endpoints[0]))) .process(new RecipientList(getContext(), simple(endpoints[1]))) .end() It works as expected, so I guess there is an internal bug somewhere. Thanks, Sebastian