2 Replies Latest reply on Jan 5, 2014 10:05 AM by Erhard Siegl

    Only one route allowed per Java DSL

    Erhard Siegl Novice



      Coming from Camel, I find the "direct:..." endpoint very convenient to structure my code. A small demo-example in Camel looks like this:



          public void configure() {


                    Namespaces ns = new Namespaces("o", "http://bergfex.at/order/1.0");















                       .process(new CheckHeaderProcessor(Exchange.FILE_NAME))


                             .when(ns.xpath("/o:order/o:person/o:city = 'London'"))










      When I try a similar thing in Switchyard I get: "org.switchyard.exception.SwitchYardException: Only one route allowed per Java DSL class ..."

      Of cource one could write everything as one route or define external References and several @Route Classes, but both solutions would make the code more difficult to read and harder to maintain.

      Are there plans to support more routes within one class or are there other alternatives especially to this use of the "direct" endpoint?

        • 1. Re: Only one route allowed per Java DSL
          Łukasz Dywicki Novice

          Hey Erhard,

          This limitation is introduced to keep clean relation between service interface and mediation behind the scenes, because every implementation.camel must be linked with interface. You are right that references are good practice in this case, instead of direct: you can use switchyard:// in uri. If you would like to have multiple entry points to service you can use different bindings (as you have JMS component).

          • 2. Re: Only one route allowed per Java DSL
            Erhard Siegl Novice

            The feature was implemented in Switchyard 1.0.0. This works now :

              public void configure() {



                             "Received message for 'Greeter' : ${body}")




                        .log("Hit direct endpoint")