1 Reply Latest reply on Dec 11, 2008 9:38 PM by Jonathan Anstey

    Processor and Endpoint difference?

    Anderson Nielson Newbie

      1. What is the main difference between a Processor and an Endpoint?


      2. When should I use a processor? And and Endpoint?


      3. For instance, to extract some XML data, using XPath, and to add this data to an ArrayList: which type should I use?

        • 1. Re: Processor and Endpoint difference?
          Jonathan Anstey Novice

          Endpoints are typically places you get messages from or send messages to. Processors are used to manipulate/mediate messages between endpoints.


          For extracting XML data from a message you can use a custom processor like:


              .process(new Processor() {
                  public void process(Exchange exchange) {
                      // do stuff to the exchange


          A bit nicer way of extracting things via XPath would be to use a custom bean though:




          This bean extracts a node list from the message body as the list parameter.

              public class MyBean {
                  public void foo(@XPath("/employees/employee") NodeList list) {
                      // do something here


          Edited by: janstey on Dec 11, 2008 11:07 PM