Class ProcessClause<T>

  • All Implemented Interfaces:
    org.apache.camel.Processor

    public class ProcessClause<T>
    extends Object
    implements org.apache.camel.Processor
    • Constructor Detail

      • ProcessClause

        public ProcessClause​(T parent)
    • Method Detail

      • process

        public void process​(org.apache.camel.Exchange exchange)
                     throws Exception
        Specified by:
        process in interface org.apache.camel.Processor
        Throws:
        Exception
      • exchange

        public T exchange​(Consumer<org.apache.camel.Exchange> consumer)
        Define a Processor which targets the Exchange.
      • message

        public T message​(Consumer<org.apache.camel.Message> consumer)
        Define a Processor which targets the Exchange In Message.
         
         from("direct:aggregate")
             .process()
                 .message(m -> m.setHeader("HasBody", m.getBody() != null));
         
         
      • body

        public T body​(Consumer<Object> consumer)
        Define a Processor which targets the Exchange In Body.
         
         from("direct:aggregate")
             .process()
                 .body(System.out::println);
         
         
      • body

        public <B> T body​(Class<B> type,
                          Consumer<B> consumer)
        Define a Processor which targets the typed Exchange In Body.
         
         from("direct:aggregate")
             .process()
                 .body(MyObject.class, MyObject::dumpToStdOut);
         
         
      • body

        public T body​(BiConsumer<Object,​Map<String,​Object>> consumer)
        Define a Processor which targets the Exchange In Body and its Headers.
         
         from("direct:aggregate")
             .process()
                 .body((b, h) -> h.put("ClassName", b.getClass().getName()));
         
         
      • body

        public <B> T body​(Class<B> type,
                          BiConsumer<B,​Map<String,​Object>> consumer)
        Define a Processor which targets the typed Exchange In Body and its Headers.
         
         from("direct:aggregate")
             .process()
                 .body(MyObject.class, (b, h) -> { 
                     if (h.containsKey("dump")) {
                          b.dumpToStdOut();
                     }
                 });