4 Replies Latest reply on Jul 27, 2012 5:43 AM by Lekan Omotayo

    RecipientList annotation on an Interface does not work

    Lekan Omotayo Expert

      Hi all,


      I was wondering why the Recipient annotation on my interface like below does not work:



      public String[] route(Exchange exchange, @XPath(value="//Service/text()", resultType=String.class) String service) throws Exception;


      and the implementation looks like:



      public String[] route(Exchange exchange, String service) throws Exception


      String[] routes = null;

      routes = new String[]{"vm:myProcessor?timeout=180000"}

      return routes;



      The implementation returns an array of strings, but Camel never treat the array of strings as recipients and thus mesages are not routed to the endpoints in the string array. Instead it executes the next line in the same camel context.


      See came context that invokes the route function:




      Instead it executes the testDataSource method in the testDriver bean, instead of going to the endpoint returned by the route function.


      Please any idea on alternative method to implement this will be appreciated. And oh, it works fine when its not an interface. But its important I make it an interface.


      I stumbled on this http://stackoverflow.com/questions/3353378/annotations-on-interfaces?rq=1. Is this correct?




      Edited by: lekkie on Jul 25, 2012 7:15 AM