Even a JavaDSL is Java code, so you could store intermediate steps while
creating the route - just "extract local variable".
So you could use Java control commands:


public class ProgrammaticalRouteTest extends CamelTestSupport {

        @Test 
        public void sendToMultipleEndpoints() throws InterruptedException {
                getMockEndpoint("mock:end1").expectedMessageCount(1);
                getMockEndpoint("mock:end2").expectedMessageCount(1);
                getMockEndpoint("mock:end3").expectedMessageCount(1);
        template.sendBody("direct:in", "test");
        assertMockEndpointsSatisfied();
        }
        
        @Override
        protected RouteBuilder createRouteBuilder() throws Exception {
                return new RouteBuilder() {
                        @Override
                        public void configure() throws Exception {
                                List<String> endpointUris = Arrays.asList(
                                        "mock:end1",
                                        "mock:end2",
                                        "mock:end3"
                                );
                                
                                RouteDefinition route = from("direct:in");
                                for(String epUri : endpointUris) {
                                        route.to(epUri);
                                }
                        }
                };
        }
}


Jan

-----Ursprüngliche Nachricht-----
Von: kiranreddykasa [mailto:kirankuma...@fss.co.in] 
Gesendet: Mittwoch, 13. Februar 2013 10:13
An: users@camel.apache.org
Betreff: building route in java dsl


Can anyone tell me how to build camel route dynamically in dsl.

I am aware of recepientlist, dynamic router.

Suppose I have a list of endpoint url's, how can i build route by iterating
the list ?? 

List<ObjectWithTypeAndURl> listOfEndpoints=............

In Route builder configure method can i define a single route in multiple
steps???

for eg..

from(listOfEndpoints.get(0));
iterating
  to(listOfEndpoints.get(..));


something like  this??





-----
Regards

kiran Reddy
--
View this message in context:
http://camel.465427.n5.nabble.com/building-route-in-java-dsl-tp5727483.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to