Child pages
  • Using getIn or getOut methods on Exchange
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Using getIn or getOut methods on Exchange

The Camel API is influenced by the JBI specification which defines a concept called Message Exchange Patterns (MEP for short). The MEP defines the messaging style used such as one-way (InOnly) or request-reply (InOut).

The Exchange API provides two methods to get a message, either getIn or getOut.

Important for Camel end users

As a Camel end user you should always prefer to use the getIn method, and frankly just forget about the getOut method.

The getOut method is only needed in special use cases and by certain Camel component such as the JBI or NMR components.

If you use the getOut method, then data from the in message would be lost. For example several Camel end users who got started with Camel, couldn't understand why their message headers was lost during route in Camel. The problem was they used getOut method in a Camel Processor. They should as said use the getIn method.

If you decide to use the getOut method and want to keep headers, attachments and the likes, then you must manually copy those information from the in to the out message.

  • No labels