org.apache.camel
Interface Exchange

All Known Implementing Classes:
DefaultExchange

public interface Exchange

An Exchange is the message container holding the information during the entire routing of a Message received by a Consumer.

During processing down the Processor chain, the Exchange provides access to the current (not the original) request and response Message messages. The Exchange also holds meta-data during its entire lifetime stored as properties accessible using the various getProperty(String) methods. The setProperty(String, Object) is used to store a property. For example you can use this to store security, SLA related data or any other information deemed useful throughout processing. If an Exchange failed during routing the Exception that caused the failure is stored and accessible via the getException() method.

An Exchange is created when a Consumer receives a request. A new Message is created, the request is set as the body of the Message and depending on the Consumer other Endpoint and protocol related information is added as headers on the Message. Then an Exchange is created and the newly created Message is set as the in on the Exchange. Therefore an Exchange starts its life in a Consumer. The Exchange is then sent down the Route for processing along a Processor chain. The Processor as the name suggests is what processes the Message in the Exchange and Camel, in addition to providing out-of-the-box a large number of useful processors, it also allows you to create your own. The rule Camel uses is to take the out Message produced by the previous Processor and set it as the in for the next Processor. If the previous Processor did not produce an out, then the in of the previous Processor is sent as the next in. At the end of the processing chain, depending on the Message Exchange Pattern (or MEP) the last out (or in of no out available) is sent by the Consumer back to the original caller.

Camel, in addition to providing out-of-the-box a large number of useful processors, it also allows you to implement and use your own. When the Exchange is passed to a Processor, it always contains an in Message and no out Message. The Processor may produce an out, depending on the nature of the Processor. The in Message can be accessed using the getIn() method. Since the out message is null when entering the Processor, the getOut() method is actually a convenient factory method that will lazily instantiate a DefaultMessage which you could populate. As an alternative you could also instantiate your specialized Message and set it on the exchange using the setOut(org.apache.camel.Message) method. Please note that a Message contains not only the body but also headers and attachments. If you are creating a new Message the headers and attachments of the in Message are not automatically copied to the out by Camel and you'll have to set the headers and attachments you need yourself. If your Processor is not producing a different Message but only needs to slightly modify the in, you can simply update the in Message returned by getIn().

See this FAQ entry for more details.


Field Summary
static String ACCEPT_CONTENT_TYPE
           
static String AGGREGATED_COMPLETED_BY
           
static String AGGREGATED_CORRELATION_KEY
           
static String AGGREGATED_SIZE
           
static String AGGREGATED_TIMEOUT
           
static String AGGREGATION_COMPLETE_ALL_GROUPS
           
static String AGGREGATION_STRATEGY
           
static String ASYNC_WAIT
           
static String AUTHENTICATION
           
static String AUTHENTICATION_FAILURE_POLICY_ID
           
static String BATCH_COMPLETE
           
static String BATCH_INDEX
           
static String BATCH_SIZE
           
static String BEAN_METHOD_NAME
           
static String BEAN_MULTI_PARAMETER_ARRAY
           
static String BINDING
           
static String BREADCRUMB_ID
           
static String CHARSET_NAME
           
static String CONTENT_ENCODING
           
static String CONTENT_LENGTH
           
static String CONTENT_TYPE
           
static String CORRELATION_ID
           
static String CREATED_TIMESTAMP
           
static String DATASET_INDEX
           
static String DEFAULT_CHARSET_PROPERTY
           
static String DESTINATION_OVERRIDE_URL
           
static String DISABLE_HTTP_STREAM_CACHE
           
static String DUPLICATE_MESSAGE
           
static String ERRORHANDLER_HANDLED
           
static String EVALUATE_EXPRESSION_RESULT
           
static String EXCEPTION_CAUGHT
           
static String EXTERNAL_REDELIVERED
           
static String FAILURE_ENDPOINT
           
static String FAILURE_HANDLED
           
static String FILE_LAST_MODIFIED
           
static String FILE_LOCAL_WORK_PATH
           
static String FILE_LOCK_FILE_ACQUIRED
           
static String FILE_NAME
           
static String FILE_NAME_ONLY
           
static String FILE_NAME_PRODUCED
           
static String FILE_PARENT
           
static String FILE_PATH
           
static String FILTER_MATCHED
           
static String FILTER_NON_XML_CHARS
           
static String GROUPED_EXCHANGE
           
static String HTTP_BASE_URI
           
static String HTTP_CHARACTER_ENCODING
           
static String HTTP_CHUNKED
           
static String HTTP_METHOD
           
static String HTTP_PATH
           
static String HTTP_PROTOCOL_VERSION
           
static String HTTP_QUERY
           
static String HTTP_RESPONSE_CODE
           
static String HTTP_SERVLET_REQUEST
           
static String HTTP_SERVLET_RESPONSE
           
static String HTTP_URI
           
static String HTTP_URL
           
static String INTERCEPTED_ENDPOINT
           
static String LANGUAGE_SCRIPT
           
static String LOG_DEBUG_BODY_MAX_CHARS
           
static String LOG_DEBUG_BODY_STREAMS
           
static String LOOP_INDEX
           
static String LOOP_SIZE
           
static String MAXIMUM_CACHE_POOL_SIZE
           
static String MAXIMUM_ENDPOINT_CACHE_SIZE
           
static String MULTICAST_COMPLETE
           
static String MULTICAST_INDEX
           
static String NOTIFY_EVENT
           
static String ON_COMPLETION
           
static String PARENT_UNIT_OF_WORK
           
static String RECEIVED_TIMESTAMP
           
static String REDELIVERED
           
static String REDELIVERY_COUNTER
           
static String REDELIVERY_DELAY
           
static String REDELIVERY_EXHAUSTED
           
static String REDELIVERY_MAX_COUNTER
           
static String ROLLBACK_ONLY
           
static String ROLLBACK_ONLY_LAST
           
static String ROUTE_STOP
           
static String SKIP_GZIP_ENCODING
           
static String SLIP_ENDPOINT
           
static String SOAP_ACTION
           
static String SPLIT_COMPLETE
           
static String SPLIT_INDEX
           
static String SPLIT_SIZE
           
static String TIMER_COUNTER
           
static String TIMER_FIRED_TIME
           
static String TIMER_NAME
           
static String TIMER_PERIOD
           
static String TIMER_TIME
           
static String TO_ENDPOINT
           
static String TRACE_EVENT
           
static String TRACE_EVENT_EXCHANGE
           
static String TRACE_EVENT_NODE_ID
           
static String TRACE_EVENT_TIMESTAMP
           
static String TRANSFER_ENCODING
           
static String UNIT_OF_WORK_EXHAUSTED
           
static String UNIT_OF_WORK_PROCESS_SYNC
           
static String XSLT_FILE_NAME
           
 
Method Summary
 void addOnCompletion(Synchronization onCompletion)
          Adds a Synchronization to be invoked as callback when this exchange is completed.
 Exchange copy()
          Creates a copy of the current message exchange so that it can be forwarded to another destination
 CamelContext getContext()
          Returns the container so that a processor can resolve endpoints from URIs
 Exception getException()
          Returns the exception associated with this exchange
<T> T
getException(Class<T> type)
          Returns the exception associated with this exchange.
 String getExchangeId()
          Returns the exchange id (unique)
 Endpoint getFromEndpoint()
          Returns the endpoint which originated this message exchange if a consumer on an endpoint created the message exchange, otherwise this property will be null
 String getFromRouteId()
          Returns the route id which originated this message exchange if a route consumer on an endpoint created the message exchange, otherwise this property will be null
 Message getIn()
          Returns the inbound request message
<T> T
getIn(Class<T> type)
          Returns the inbound request message as the given type
 Message getOut()
          Returns the outbound message, lazily creating one if one has not already been associated with this exchange.
<T> T
getOut(Class<T> type)
          Returns the outbound request message as the given type


Important: If you want to change the current message, then use getIn() instead as it will ensure headers etc.

 ExchangePattern getPattern()
          Returns the ExchangePattern (MEP) of this exchange.
 Map<String,Object> getProperties()
          Returns all of the properties associated with the exchange
 Object getProperty(String name)
          Returns a property associated with this exchange by name
<T> T
getProperty(String name, Class<T> type)
          Returns a property associated with this exchange by name and specifying the type required
 Object getProperty(String name, Object defaultValue)
          Returns a property associated with this exchange by name
<T> T
getProperty(String name, Object defaultValue, Class<T> type)
          Returns a property associated with this exchange by name and specifying the type required
 UnitOfWork getUnitOfWork()
          Returns the unit of work that this exchange belongs to; which may map to zero, one or more physical transactions
 List<Synchronization> handoverCompletions()
          Handover all the on completions from this exchange
 void handoverCompletions(Exchange target)
          Handover all the on completions from this exchange to the target exchange.
 boolean hasOut()
          Returns whether an OUT message has been set or not.
 boolean hasProperties()
          Returns whether any properties has been set
 Boolean isExternalRedelivered()
          Returns true if this exchange is an external initiated redelivered message (such as a JMS broker).
 boolean isFailed()
          Returns true if this exchange failed due to either an exception or fault
 boolean isRollbackOnly()
          Returns true if this exchange is marked for rollback
 boolean isTransacted()
          Returns true if this exchange is transacted
 Object removeProperty(String name)
          Removes the given property on the exchange
 void setException(Throwable t)
          Sets the exception associated with this exchange

Camel will wrap Throwable into Exception type to accommodate for the getException() method returning a plain Exception type.

 void setExchangeId(String id)
          Set the exchange id
 void setFromEndpoint(Endpoint fromEndpoint)
          Sets the endpoint which originated this message exchange.
 void setFromRouteId(String fromRouteId)
          Sets the route id which originated this message exchange.
 void setIn(Message in)
          Sets the inbound message instance
 void setOut(Message out)
          Sets the outbound message
 void setPattern(ExchangePattern pattern)
          Allows the ExchangePattern (MEP) of this exchange to be customized.
 void setProperty(String name, Object value)
          Sets a property on the exchange
 void setUnitOfWork(UnitOfWork unitOfWork)
          Sets the unit of work that this exchange belongs to; which may map to zero, one or more physical transactions
 

Field Detail

AUTHENTICATION

static final String AUTHENTICATION
See Also:
Constant Field Values

AUTHENTICATION_FAILURE_POLICY_ID

static final String AUTHENTICATION_FAILURE_POLICY_ID
See Also:
Constant Field Values

ACCEPT_CONTENT_TYPE

static final String ACCEPT_CONTENT_TYPE
See Also:
Constant Field Values

AGGREGATED_SIZE

static final String AGGREGATED_SIZE
See Also:
Constant Field Values

AGGREGATED_TIMEOUT

static final String AGGREGATED_TIMEOUT
See Also:
Constant Field Values

AGGREGATED_COMPLETED_BY

static final String AGGREGATED_COMPLETED_BY
See Also:
Constant Field Values

AGGREGATED_CORRELATION_KEY

static final String AGGREGATED_CORRELATION_KEY
See Also:
Constant Field Values

AGGREGATION_STRATEGY

static final String AGGREGATION_STRATEGY
See Also:
Constant Field Values

AGGREGATION_COMPLETE_ALL_GROUPS

static final String AGGREGATION_COMPLETE_ALL_GROUPS
See Also:
Constant Field Values

ASYNC_WAIT

static final String ASYNC_WAIT
See Also:
Constant Field Values

BATCH_INDEX

static final String BATCH_INDEX
See Also:
Constant Field Values

BATCH_SIZE

static final String BATCH_SIZE
See Also:
Constant Field Values

BATCH_COMPLETE

static final String BATCH_COMPLETE
See Also:
Constant Field Values

BEAN_METHOD_NAME

static final String BEAN_METHOD_NAME
See Also:
Constant Field Values

BEAN_MULTI_PARAMETER_ARRAY

static final String BEAN_MULTI_PARAMETER_ARRAY
See Also:
Constant Field Values

BINDING

static final String BINDING
See Also:
Constant Field Values

BREADCRUMB_ID

static final String BREADCRUMB_ID
See Also:
Constant Field Values

CHARSET_NAME

static final String CHARSET_NAME
See Also:
Constant Field Values

CREATED_TIMESTAMP

static final String CREATED_TIMESTAMP
See Also:
Constant Field Values

CONTENT_ENCODING

static final String CONTENT_ENCODING
See Also:
Constant Field Values

CONTENT_LENGTH

static final String CONTENT_LENGTH
See Also:
Constant Field Values

CONTENT_TYPE

static final String CONTENT_TYPE
See Also:
Constant Field Values

CORRELATION_ID

static final String CORRELATION_ID
See Also:
Constant Field Values

DATASET_INDEX

static final String DATASET_INDEX
See Also:
Constant Field Values

DEFAULT_CHARSET_PROPERTY

static final String DEFAULT_CHARSET_PROPERTY
See Also:
Constant Field Values

DESTINATION_OVERRIDE_URL

static final String DESTINATION_OVERRIDE_URL
See Also:
Constant Field Values

DISABLE_HTTP_STREAM_CACHE

static final String DISABLE_HTTP_STREAM_CACHE
See Also:
Constant Field Values

DUPLICATE_MESSAGE

static final String DUPLICATE_MESSAGE
See Also:
Constant Field Values

EXCEPTION_CAUGHT

static final String EXCEPTION_CAUGHT
See Also:
Constant Field Values

EVALUATE_EXPRESSION_RESULT

static final String EVALUATE_EXPRESSION_RESULT
See Also:
Constant Field Values

ERRORHANDLER_HANDLED

static final String ERRORHANDLER_HANDLED
See Also:
Constant Field Values

EXTERNAL_REDELIVERED

static final String EXTERNAL_REDELIVERED
See Also:
Constant Field Values

FAILURE_HANDLED

static final String FAILURE_HANDLED
See Also:
Constant Field Values

FAILURE_ENDPOINT

static final String FAILURE_ENDPOINT
See Also:
Constant Field Values

FILTER_NON_XML_CHARS

static final String FILTER_NON_XML_CHARS
See Also:
Constant Field Values

FILE_LOCAL_WORK_PATH

static final String FILE_LOCAL_WORK_PATH
See Also:
Constant Field Values

FILE_NAME

static final String FILE_NAME
See Also:
Constant Field Values

FILE_NAME_ONLY

static final String FILE_NAME_ONLY
See Also:
Constant Field Values

FILE_NAME_PRODUCED

static final String FILE_NAME_PRODUCED
See Also:
Constant Field Values

FILE_PATH

static final String FILE_PATH
See Also:
Constant Field Values

FILE_PARENT

static final String FILE_PARENT
See Also:
Constant Field Values

FILE_LAST_MODIFIED

static final String FILE_LAST_MODIFIED
See Also:
Constant Field Values

FILTER_MATCHED

static final String FILTER_MATCHED
See Also:
Constant Field Values

FILE_LOCK_FILE_ACQUIRED

static final String FILE_LOCK_FILE_ACQUIRED
See Also:
Constant Field Values

GROUPED_EXCHANGE

static final String GROUPED_EXCHANGE
See Also:
Constant Field Values

HTTP_BASE_URI

static final String HTTP_BASE_URI
See Also:
Constant Field Values

HTTP_CHARACTER_ENCODING

static final String HTTP_CHARACTER_ENCODING
See Also:
Constant Field Values

HTTP_METHOD

static final String HTTP_METHOD
See Also:
Constant Field Values

HTTP_PATH

static final String HTTP_PATH
See Also:
Constant Field Values

HTTP_PROTOCOL_VERSION

static final String HTTP_PROTOCOL_VERSION
See Also:
Constant Field Values

HTTP_QUERY

static final String HTTP_QUERY
See Also:
Constant Field Values

HTTP_RESPONSE_CODE

static final String HTTP_RESPONSE_CODE
See Also:
Constant Field Values

HTTP_URI

static final String HTTP_URI
See Also:
Constant Field Values

HTTP_URL

static final String HTTP_URL
See Also:
Constant Field Values

HTTP_CHUNKED

static final String HTTP_CHUNKED
See Also:
Constant Field Values

HTTP_SERVLET_REQUEST

static final String HTTP_SERVLET_REQUEST
See Also:
Constant Field Values

HTTP_SERVLET_RESPONSE

static final String HTTP_SERVLET_RESPONSE
See Also:
Constant Field Values

INTERCEPTED_ENDPOINT

static final String INTERCEPTED_ENDPOINT
See Also:
Constant Field Values

LANGUAGE_SCRIPT

static final String LANGUAGE_SCRIPT
See Also:
Constant Field Values

LOG_DEBUG_BODY_MAX_CHARS

static final String LOG_DEBUG_BODY_MAX_CHARS
See Also:
Constant Field Values

LOG_DEBUG_BODY_STREAMS

static final String LOG_DEBUG_BODY_STREAMS
See Also:
Constant Field Values

LOOP_INDEX

static final String LOOP_INDEX
See Also:
Constant Field Values

LOOP_SIZE

static final String LOOP_SIZE
See Also:
Constant Field Values

MAXIMUM_CACHE_POOL_SIZE

static final String MAXIMUM_CACHE_POOL_SIZE
See Also:
Constant Field Values

MAXIMUM_ENDPOINT_CACHE_SIZE

static final String MAXIMUM_ENDPOINT_CACHE_SIZE
See Also:
Constant Field Values

MULTICAST_INDEX

static final String MULTICAST_INDEX
See Also:
Constant Field Values

MULTICAST_COMPLETE

static final String MULTICAST_COMPLETE
See Also:
Constant Field Values

NOTIFY_EVENT

static final String NOTIFY_EVENT
See Also:
Constant Field Values

ON_COMPLETION

static final String ON_COMPLETION
See Also:
Constant Field Values

PARENT_UNIT_OF_WORK

static final String PARENT_UNIT_OF_WORK
See Also:
Constant Field Values

RECEIVED_TIMESTAMP

static final String RECEIVED_TIMESTAMP
See Also:
Constant Field Values

REDELIVERED

static final String REDELIVERED
See Also:
Constant Field Values

REDELIVERY_COUNTER

static final String REDELIVERY_COUNTER
See Also:
Constant Field Values

REDELIVERY_MAX_COUNTER

static final String REDELIVERY_MAX_COUNTER
See Also:
Constant Field Values

REDELIVERY_EXHAUSTED

static final String REDELIVERY_EXHAUSTED
See Also:
Constant Field Values

REDELIVERY_DELAY

static final String REDELIVERY_DELAY
See Also:
Constant Field Values

ROLLBACK_ONLY

static final String ROLLBACK_ONLY
See Also:
Constant Field Values

ROLLBACK_ONLY_LAST

static final String ROLLBACK_ONLY_LAST
See Also:
Constant Field Values

ROUTE_STOP

static final String ROUTE_STOP
See Also:
Constant Field Values

SOAP_ACTION

static final String SOAP_ACTION
See Also:
Constant Field Values

SKIP_GZIP_ENCODING

static final String SKIP_GZIP_ENCODING
See Also:
Constant Field Values

SLIP_ENDPOINT

static final String SLIP_ENDPOINT
See Also:
Constant Field Values

SPLIT_INDEX

static final String SPLIT_INDEX
See Also:
Constant Field Values

SPLIT_COMPLETE

static final String SPLIT_COMPLETE
See Also:
Constant Field Values

SPLIT_SIZE

static final String SPLIT_SIZE
See Also:
Constant Field Values

TIMER_COUNTER

static final String TIMER_COUNTER
See Also:
Constant Field Values

TIMER_FIRED_TIME

static final String TIMER_FIRED_TIME
See Also:
Constant Field Values

TIMER_NAME

static final String TIMER_NAME
See Also:
Constant Field Values

TIMER_PERIOD

static final String TIMER_PERIOD
See Also:
Constant Field Values

TIMER_TIME

static final String TIMER_TIME
See Also:
Constant Field Values

TO_ENDPOINT

static final String TO_ENDPOINT
See Also:
Constant Field Values

TRACE_EVENT

static final String TRACE_EVENT
See Also:
Constant Field Values

TRACE_EVENT_NODE_ID

static final String TRACE_EVENT_NODE_ID
See Also:
Constant Field Values

TRACE_EVENT_TIMESTAMP

static final String TRACE_EVENT_TIMESTAMP
See Also:
Constant Field Values

TRACE_EVENT_EXCHANGE

static final String TRACE_EVENT_EXCHANGE
See Also:
Constant Field Values

TRANSFER_ENCODING

static final String TRANSFER_ENCODING
See Also:
Constant Field Values

UNIT_OF_WORK_EXHAUSTED

static final String UNIT_OF_WORK_EXHAUSTED
See Also:
Constant Field Values

UNIT_OF_WORK_PROCESS_SYNC

static final String UNIT_OF_WORK_PROCESS_SYNC
See Also:
Constant Field Values

XSLT_FILE_NAME

static final String XSLT_FILE_NAME
See Also:
Constant Field Values
Method Detail

getPattern

ExchangePattern getPattern()
Returns the ExchangePattern (MEP) of this exchange.

Returns:
the message exchange pattern of this exchange

setPattern

void setPattern(ExchangePattern pattern)
Allows the ExchangePattern (MEP) of this exchange to be customized. This typically won't be required as an exchange can be created with a specific MEP by calling Endpoint.createExchange(ExchangePattern) but it is here just in case it is needed.

Parameters:
pattern - the pattern

getProperty

Object getProperty(String name)
Returns a property associated with this exchange by name

Parameters:
name - the name of the property
Returns:
the value of the given property or null if there is no property for the given name

getProperty

Object getProperty(String name,
                   Object defaultValue)
Returns a property associated with this exchange by name

Parameters:
name - the name of the property
defaultValue - the default value to return if property was absent
Returns:
the value of the given property or defaultValue if there is no property for the given name

getProperty

<T> T getProperty(String name,
                  Class<T> type)
Returns a property associated with this exchange by name and specifying the type required

Parameters:
name - the name of the property
type - the type of the property
Returns:
the value of the given property or null if there is no property for the given name or null if it cannot be converted to the given type

getProperty

<T> T getProperty(String name,
                  Object defaultValue,
                  Class<T> type)
Returns a property associated with this exchange by name and specifying the type required

Parameters:
name - the name of the property
defaultValue - the default value to return if property was absent
type - the type of the property
Returns:
the value of the given property or defaultValue if there is no property for the given name or null if it cannot be converted to the given type

setProperty

void setProperty(String name,
                 Object value)
Sets a property on the exchange

Parameters:
name - of the property
value - to associate with the name

removeProperty

Object removeProperty(String name)
Removes the given property on the exchange

Parameters:
name - of the property
Returns:
the old value of the property

getProperties

Map<String,Object> getProperties()
Returns all of the properties associated with the exchange

Returns:
all the headers in a Map

hasProperties

boolean hasProperties()
Returns whether any properties has been set

Returns:
true if any properties has been set

getIn

Message getIn()
Returns the inbound request message

Returns:
the message

getIn

<T> T getIn(Class<T> type)
Returns the inbound request message as the given type

Parameters:
type - the given type
Returns:
the message as the given type or null if not possible to covert to given type

setIn

void setIn(Message in)
Sets the inbound message instance

Parameters:
in - the inbound message

getOut

Message getOut()
Returns the outbound message, lazily creating one if one has not already been associated with this exchange.


Important: If you want to change the current message, then use getIn() instead as it will ensure headers etc. is kept and propagated when routing continues. Bottom line end users should rarely use this method.


If you want to test whether an OUT message have been set or not, use the hasOut() method.

See also the class java doc for this Exchange for more details and this FAQ entry.

Returns:
the response
See Also:
getIn()

getOut

<T> T getOut(Class<T> type)
Returns the outbound request message as the given type


Important: If you want to change the current message, then use getIn() instead as it will ensure headers etc. is kept and propagated when routing continues. Bottom line end users should rarely use this method.


If you want to test whether an OUT message have been set or not, use the hasOut() method.

See also the class java doc for this Exchange for more details and this FAQ entry.

Parameters:
type - the given type
Returns:
the message as the given type or null if not possible to covert to given type
See Also:
getIn(Class)

hasOut

boolean hasOut()
Returns whether an OUT message has been set or not.

Returns:
true if an OUT message exists, false otherwise.

setOut

void setOut(Message out)
Sets the outbound message

Parameters:
out - the outbound message

getException

Exception getException()
Returns the exception associated with this exchange

Returns:
the exception (or null if no faults)

getException

<T> T getException(Class<T> type)
Returns the exception associated with this exchange.

Is used to get the caused exception that typically have been wrapped in some sort of Camel wrapper exception

The strategy is to look in the exception hierarchy to find the first given cause that matches the type. Will start from the bottom (the real cause) and walk upwards.

Parameters:
type - the exception type
Returns:
the exception (or null if no caused exception matched)

setException

void setException(Throwable t)
Sets the exception associated with this exchange

Camel will wrap Throwable into Exception type to accommodate for the getException() method returning a plain Exception type.

Parameters:
t - the caused exception

isFailed

boolean isFailed()
Returns true if this exchange failed due to either an exception or fault

Returns:
true if this exchange failed due to either an exception or fault
See Also:
getException(), Message.setFault(boolean), Message.isFault()

isTransacted

boolean isTransacted()
Returns true if this exchange is transacted


isExternalRedelivered

Boolean isExternalRedelivered()
Returns true if this exchange is an external initiated redelivered message (such as a JMS broker).

Important: It is not always possible to determine if the message is a redelivery or not, and therefore null is returned. Such an example would be a JDBC message. However JMS brokers provides details if a message is redelivered.

Returns:
true if redelivered, false if not, null if not able to determine

isRollbackOnly

boolean isRollbackOnly()
Returns true if this exchange is marked for rollback


getContext

CamelContext getContext()
Returns the container so that a processor can resolve endpoints from URIs

Returns:
the container which owns this exchange

copy

Exchange copy()
Creates a copy of the current message exchange so that it can be forwarded to another destination


getFromEndpoint

Endpoint getFromEndpoint()
Returns the endpoint which originated this message exchange if a consumer on an endpoint created the message exchange, otherwise this property will be null


setFromEndpoint

void setFromEndpoint(Endpoint fromEndpoint)
Sets the endpoint which originated this message exchange. This method should typically only be called by Endpoint implementations

Parameters:
fromEndpoint - the endpoint which is originating this message exchange

getFromRouteId

String getFromRouteId()
Returns the route id which originated this message exchange if a route consumer on an endpoint created the message exchange, otherwise this property will be null


setFromRouteId

void setFromRouteId(String fromRouteId)
Sets the route id which originated this message exchange. This method should typically only be called by the internal framework.

Parameters:
fromRouteId - the from route id

getUnitOfWork

UnitOfWork getUnitOfWork()
Returns the unit of work that this exchange belongs to; which may map to zero, one or more physical transactions


setUnitOfWork

void setUnitOfWork(UnitOfWork unitOfWork)
Sets the unit of work that this exchange belongs to; which may map to zero, one or more physical transactions


getExchangeId

String getExchangeId()
Returns the exchange id (unique)


setExchangeId

void setExchangeId(String id)
Set the exchange id


addOnCompletion

void addOnCompletion(Synchronization onCompletion)
Adds a Synchronization to be invoked as callback when this exchange is completed.

Parameters:
onCompletion - the callback to invoke on completion of this exchange

handoverCompletions

void handoverCompletions(Exchange target)
Handover all the on completions from this exchange to the target exchange.

Parameters:
target - the target exchange

handoverCompletions

List<Synchronization> handoverCompletions()
Handover all the on completions from this exchange

Returns:
the on completions


Apache CAMEL