2 Replies Latest reply on Sep 11, 2013 3:07 AM by pzl_mz

    Multiple Transformations On Camel Route's Contract

    pzl_mz

      My setup is as follows:

      Component 1 is a Camel route which splits messages in two categories and routes them to Component 2

      Component 2 is a Camel route which aggregates the the two messages categories

      The two message categories need to get transformed between Component 1 and Component 2; each of the categories should have a different transformation.

       

      As far as I know it is not possible to have multiple methods on Component 2's java interface in combination with operationName on Component 1. Is there a workaround to get different transformations to get applied somehow else?

        • 1. Re: Multiple Transformations On Camel Route's Contract
          kcbabo

          This should work.  If the service provided by Component 2 is something like this:

          public interface Component2 {
            void abc(Foo foo);
            void xyz(Bar bar);
          }
          
          

           

          And Component1 uses the following as a reference interface:

          public interface Component2Ref {
            void abc(MyFoo myFoo);
            void xyz(MyBar bar);
          }
          
          

           

          You can invoke each operation from the Camel route using the operation parameter:

          from("switchyard://Component1")
            .to("switchyard://Component2Ref?operationName=abc")
            .to("switchyard://Component2Ref?operationName=xyz");
          
          

           

          This would trigger transforms of Foo -> MyFoo and Bar -> MyBar.

           

          Is this what you're after?  If not, please post the Camel route, switchyard.xml, and the relevant interfaces you are using.

          • 2. Re: Multiple Transformations On Camel Route's Contract
            pzl_mz

            Adding the two methods to the Component2Ref's interface did the trick, thanks!