Class ExchangeBuilder

java.lang.Object
org.apache.camel.builder.ExchangeBuilder

public final class ExchangeBuilder extends Object
Builder to create Exchange and add headers and set body on the Exchange Message.

Use the build() method when done setting up the exchange.

  • Constructor Details

    • ExchangeBuilder

      public ExchangeBuilder(org.apache.camel.CamelContext context)
  • Method Details

    • anExchange

      public static ExchangeBuilder anExchange(org.apache.camel.CamelContext context)
      Create the exchange by setting the camel context
      Parameters:
      context - the camel context
      Returns:
      exchange builder
    • withBody

      public ExchangeBuilder withBody(Object body)
      Set the in message body on the exchange
      Parameters:
      body - the body
      Returns:
      exchange builder
    • withHeader

      public ExchangeBuilder withHeader(String key, Object value)
      Set the message header of the in message on the exchange
      Parameters:
      key - the key of the header
      value - the value of the header
      Returns:
      exchange builder
    • withPattern

      public ExchangeBuilder withPattern(org.apache.camel.ExchangePattern pattern)
      Set the message exchange pattern on the exchange
      Parameters:
      pattern - exchange pattern
      Returns:
      exchange builder
    • withProperty

      public ExchangeBuilder withProperty(String key, Object value)
      Set the exchange property
      Parameters:
      key - the key of the exchange property
      value - the value of the exchange property
      Returns:
      exchange builder
    • build

      public org.apache.camel.Exchange build()
      Build up the exchange from the exchange builder
      Returns:
      exchange