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.