public class ContractAdvice extends Object implements CamelInternalProcessorAdvice
CamelInternalProcessorAdvice
which applies Transformer
and Validator
according to the data type Contract.
The default camel Message
implements DataTypeAware
which
holds a DataType
to indicate current message type. If the input type
declared by InputTypeDefinition
is different from current IN message type,
camel internal processor look for a Transformer which transforms from the current
message type to the expected message type before routing.
After routing, if the output type declared by OutputTypeDefinition
is different
from current OUT message (or IN message if no OUT), camel look for a Transformer and apply.Transformer
,
Validator
,
InputTypeDefinition
,
OutputTypeDefinition
Constructor and Description |
---|
ContractAdvice(Contract contract) |
Modifier and Type | Method and Description |
---|---|
void |
after(Exchange exchange,
Object data)
Callback executed after processing a step in the route.
|
Object |
before(Exchange exchange)
Callback executed before processing a step in the route.
|
public ContractAdvice(Contract contract)
public Object before(Exchange exchange) throws Exception
CamelInternalProcessorAdvice
before
in interface CamelInternalProcessorAdvice
exchange
- the current exchangeCamelInternalProcessorAdvice.after(org.apache.camel.Exchange, Object)
method, or use null for no state.Exception
- is thrown if error during the call.public void after(Exchange exchange, Object data) throws Exception
CamelInternalProcessorAdvice
after
in interface CamelInternalProcessorAdvice
exchange
- the current exchangedata
- the state, if any, returned in the CamelInternalProcessorAdvice.before(org.apache.camel.Exchange)
method.Exception
- is thrown if error during the call.Apache Camel