Reputation: 2820
Having an Apache Camel route defined in Java, I can do something like this
from("stream:in?promptMessage=Enter something: ")
.loadBalance()
.to("uria", "urib")
and it works like a charme.
Trying this using a Spring context file doesn't work out:
<c:camelContext id="defaultContext">
<c:route id="defaultRoute">
<c:from uri="stream:in?promptMessage=Enter something: "/>
<c:loadBalance inheritErrorHandler="false">
<c:to uri="uria, urib"/>
</c:loadBalance>
<c:to uri="stream:out"/>
</c:route>
</c:camelContext>
Any idea, how i can set more than one uri per <c:to ...
element? I do not want to have multiple <c:to ...
elements. Is there any way, e.g. having a route factory passing the list?
What is the cause I want to achieve this: I'd like to inject a list of URIs from a configuration file passing them directly to the Camel route.
I'm using version 2.12.1 of Apache Camel.
Upvotes: 1
Views: 1297
Reputation: 1376
The RouteBuilder class shall be
@Component
public class MyRoute extends SpringRouteBuilder {
@Override
public void configure() throws Exception {
String URIs = // read all URI's from file or somewhere
from("direct:start")
.loadbalance()
.to(URIs);
}
}
Upvotes: 1