Class AggregationStrategyClause<T>

  • All Implemented Interfaces:
    org.apache.camel.AggregationStrategy
    Direct Known Subclasses:
    EnrichClause

    public class AggregationStrategyClause<T>
    extends Object
    implements org.apache.camel.AggregationStrategy
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.camel.Exchange aggregate​(org.apache.camel.Exchange oldExchange, org.apache.camel.Exchange newExchange)  
      org.apache.camel.Exchange aggregate​(org.apache.camel.Exchange oldExchange, org.apache.camel.Exchange newExchange, org.apache.camel.Exchange inputExchange)  
      <B> T body​(Class<B> type, BiFunction<B,​B,​Object> function)
      Define an aggregation strategy which targets Exchanges In Body.
      <O,​N>
      T
      body​(Class<O> oldType, Class<N> newType, BiFunction<O,​N,​Object> function)
      Define an aggregation strategy which targets Exchanges In Body.
      T body​(BiFunction<Object,​Object,​Object> function)
      Define an aggregation strategy which targets Exchanges In Body.
      T exchange​(BiFunction<org.apache.camel.Exchange,​org.apache.camel.Exchange,​org.apache.camel.Exchange> function)
      Define an aggregation strategy which targets the exchnage.
      T message​(BiFunction<org.apache.camel.Message,​org.apache.camel.Message,​org.apache.camel.Message> function)
      Define an aggregation strategy which targets Exchanges In Message.
      • Methods inherited from interface org.apache.camel.AggregationStrategy

        canPreComplete, onCompletion, onCompletion, onOptimisticLockFailure, preComplete, timeout
    • Constructor Detail

      • AggregationStrategyClause

        public AggregationStrategyClause​(T parent)
    • Method Detail

      • aggregate

        public org.apache.camel.Exchange aggregate​(org.apache.camel.Exchange oldExchange,
                                                   org.apache.camel.Exchange newExchange)
        Specified by:
        aggregate in interface org.apache.camel.AggregationStrategy
      • aggregate

        public org.apache.camel.Exchange aggregate​(org.apache.camel.Exchange oldExchange,
                                                   org.apache.camel.Exchange newExchange,
                                                   org.apache.camel.Exchange inputExchange)
        Specified by:
        aggregate in interface org.apache.camel.AggregationStrategy
      • exchange

        public T exchange​(BiFunction<org.apache.camel.Exchange,​org.apache.camel.Exchange,​org.apache.camel.Exchange> function)
        Define an aggregation strategy which targets the exchnage.
      • message

        public T message​(BiFunction<org.apache.camel.Message,​org.apache.camel.Message,​org.apache.camel.Message> function)
        Define an aggregation strategy which targets Exchanges In Message.
         
         from("direct:aggregate")
             .aggregate()
                 .message((old, new) -> {
                     if (old == null) {
                         return new;
                     }
        
                     String oldBody = old.getBody(String.class);
                     String newBody = new.getBody(String.class);
        
                     old.setBody(oldBody + "+" + newBody);
        
                     return old;
                 });
         
         
      • body

        public T body​(BiFunction<Object,​Object,​Object> function)
        Define an aggregation strategy which targets Exchanges In Body.
         
         from("direct:aggregate")
             .aggregate()
                 .body((old, new) -> {
                     if (old == null) {
                         return new;
                     }
        
                     return old.toString() + new.toString();
                 });
         
         
      • body

        public <B> T body​(Class<B> type,
                          BiFunction<B,​B,​Object> function)
        Define an aggregation strategy which targets Exchanges In Body.
         
         from("direct:aggregate")
             .aggregate()
                 .body(String.class, (old, new) -> {
                     if (old == null) {
                         return new;
                     }
        
                     return old + new;
                 });
         
         
      • body

        public <O,​N> T body​(Class<O> oldType,
                                  Class<N> newType,
                                  BiFunction<O,​N,​Object> function)
        Define an aggregation strategy which targets Exchanges In Body.