1 Reply Latest reply on Aug 19, 2011 10:54 AM by Claus Ibsen

    invoking methods on messages?

    jamie archibald Apprentice

      I was curious if there was a way to invoke methods on the incoming messages for performing choice() or setHeader() functions. I looked around on the website but couldn't find anything. Currently I have to write custom processors to do these types of simple jobs.

       

      e.g.

       

      class Person {

         public boolean isCool() {

           return false;

         }

      }

       

      from("direct:foo")

      .choice()

         .when(body().method("isCool")).to("direct:coolPeople")

          .otherwise().to("direct:uncoolPeople");

       

      from("direct:foo");

      .setHeader("IsCool", body().method("isCool"));