Modifier and Type | Field and Description |
---|---|
protected CamelContext |
context |
ACCEPT_CONTENT_TYPE, AGGREGATED_COLLECTION_GUARD, AGGREGATED_COMPLETED_BY, AGGREGATED_CORRELATION_KEY, AGGREGATED_SIZE, AGGREGATED_TIMEOUT, AGGREGATION_COMPLETE_ALL_GROUPS, AGGREGATION_COMPLETE_ALL_GROUPS_INCLUSIVE, AGGREGATION_COMPLETE_CURRENT_GROUP, AGGREGATION_STRATEGY, ASYNC_WAIT, AUTHENTICATION, AUTHENTICATION_FAILURE_POLICY_ID, BATCH_COMPLETE, BATCH_INDEX, BATCH_SIZE, BEAN_METHOD_NAME, BEAN_MULTI_PARAMETER_ARRAY, BINDING, BREADCRUMB_ID, CHARSET_NAME, CIRCUIT_BREAKER_STATE, COMPILE_SCRIPT, CONTENT_ENCODING, CONTENT_LENGTH, CONTENT_TYPE, CORRELATION_ID, CREATED_TIMESTAMP, DATASET_INDEX, DEFAULT_CHARSET_PROPERTY, DESTINATION_OVERRIDE_URL, DISABLE_HTTP_STREAM_CACHE, DOCUMENT_BUILDER_FACTORY, DUPLICATE_MESSAGE, ERRORHANDLER_HANDLED, EVALUATE_EXPRESSION_RESULT, EXCEPTION_CAUGHT, EXCEPTION_HANDLED, EXTERNAL_REDELIVERED, FAILURE_ENDPOINT, FAILURE_HANDLED, FAILURE_ROUTE_ID, FILE_CONTENT_TYPE, FILE_LAST_MODIFIED, FILE_LENGTH, FILE_LOCAL_WORK_PATH, FILE_LOCK_EXCLUSIVE_LOCK, FILE_LOCK_FILE_ACQUIRED, FILE_LOCK_FILE_NAME, FILE_LOCK_RANDOM_ACCESS_FILE, FILE_NAME, FILE_NAME_CONSUMED, FILE_NAME_ONLY, FILE_NAME_PRODUCED, FILE_PARENT, FILE_PATH, FILTER_MATCHED, FILTER_NON_XML_CHARS, GROUPED_EXCHANGE, HTTP_BASE_URI, HTTP_CHARACTER_ENCODING, HTTP_CHUNKED, HTTP_METHOD, HTTP_PATH, HTTP_PROTOCOL_VERSION, HTTP_QUERY, HTTP_RAW_QUERY, HTTP_RESPONSE_CODE, HTTP_RESPONSE_TEXT, HTTP_SERVLET_REQUEST, HTTP_SERVLET_RESPONSE, HTTP_URI, HTTP_URL, INTERCEPT_SEND_TO_ENDPOINT_WHEN_MATCHED, INTERCEPTED_ENDPOINT, LANGUAGE_SCRIPT, LOG_DEBUG_BODY_MAX_CHARS, LOG_DEBUG_BODY_STREAMS, LOG_EIP_NAME, LOOP_INDEX, LOOP_SIZE, MAXIMUM_CACHE_POOL_SIZE, MAXIMUM_ENDPOINT_CACHE_SIZE, MESSAGE_HISTORY, MULTICAST_COMPLETE, MULTICAST_INDEX, NOTIFY_EVENT, ON_COMPLETION, OVERRULE_FILE_NAME, PARENT_UNIT_OF_WORK, RECEIVED_TIMESTAMP, RECIPIENT_LIST_ENDPOINT, REDELIVERED, REDELIVERY_COUNTER, REDELIVERY_DELAY, REDELIVERY_EXHAUSTED, REDELIVERY_MAX_COUNTER, REUSE_SCRIPT_ENGINE, ROLLBACK_ONLY, ROLLBACK_ONLY_LAST, ROUTE_STOP, SAXPARSER_FACTORY, SCHEDULER_POLLED_MESSAGES, SKIP_GZIP_ENCODING, SKIP_WWW_FORM_URLENCODED, SLIP_ENDPOINT, SOAP_ACTION, SPLIT_COMPLETE, SPLIT_INDEX, SPLIT_SIZE, STREAM_CACHE_UNIT_OF_WORK, TIMER_COUNTER, TIMER_FIRED_TIME, TIMER_NAME, TIMER_PERIOD, TIMER_TIME, TO_ENDPOINT, TRACE_EVENT, TRACE_EVENT_EXCHANGE, TRACE_EVENT_NODE_ID, TRACE_EVENT_TIMESTAMP, TRANSFER_ENCODING, TRY_ROUTE_BLOCK, UNIT_OF_WORK_EXHAUSTED, UNIT_OF_WORK_PROCESS_SYNC, XSLT_ERROR, XSLT_FATAL_ERROR, XSLT_FILE_NAME, XSLT_WARNING
Constructor and Description |
---|
DefaultExchange(CamelContext context) |
DefaultExchange(CamelContext context,
ExchangePattern pattern) |
DefaultExchange(Endpoint fromEndpoint) |
DefaultExchange(Endpoint fromEndpoint,
ExchangePattern pattern) |
DefaultExchange(Exchange parent) |
Modifier and Type | Method and Description |
---|---|
void |
addOnCompletion(Synchronization onCompletion)
Adds a
Synchronization to be invoked as callback when
this exchange is completed. |
protected void |
configureMessage(Message message)
Configures the message after it has been set on the exchange
|
boolean |
containsOnCompletion(Synchronization onCompletion)
Checks if the passed
Synchronization instance is
already contained on this exchange. |
Exchange |
copy()
Creates a copy of the current message exchange so that it can be
forwarded to another destination
Notice this operation invokes copy(false) |
Exchange |
copy(boolean safeCopy)
Creates a copy of the current message exchange so that it can be
forwarded to another destination
|
protected String |
createExchangeId() |
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
|
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
|
boolean |
removeProperties(String pattern)
Remove all of the properties associated with the exchange matching a specific pattern
|
boolean |
removeProperties(String pattern,
String... excludePatterns)
Removes the properties from this exchange that match the given pattern,
except for the ones matching one ore more excludePatterns
|
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 |
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 |
setProperties(Map<String,Object> properties) |
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
|
String |
toString() |
protected final CamelContext context
public DefaultExchange(CamelContext context)
public DefaultExchange(CamelContext context, ExchangePattern pattern)
public DefaultExchange(Exchange parent)
public DefaultExchange(Endpoint fromEndpoint)
public DefaultExchange(Endpoint fromEndpoint, ExchangePattern pattern)
public Exchange copy()
Exchange
Notice this operation invokes copy(false)
public Exchange copy(boolean safeCopy)
Exchange
public CamelContext getContext()
Exchange
getContext
in interface Exchange
public Object getProperty(String name)
Exchange
getProperty
in interface Exchange
name
- the name of the propertypublic Object getProperty(String name, Object defaultValue)
Exchange
getProperty
in interface Exchange
name
- the name of the propertydefaultValue
- the default value to return if property was absentpublic <T> T getProperty(String name, Class<T> type)
Exchange
getProperty
in interface Exchange
name
- the name of the propertytype
- the type of the propertypublic <T> T getProperty(String name, Object defaultValue, Class<T> type)
Exchange
getProperty
in interface Exchange
name
- the name of the propertydefaultValue
- the default value to return if property was absenttype
- the type of the propertypublic void setProperty(String name, Object value)
Exchange
setProperty
in interface Exchange
name
- of the propertyvalue
- to associate with the namepublic Object removeProperty(String name)
Exchange
removeProperty
in interface Exchange
name
- of the propertypublic boolean removeProperties(String pattern)
Exchange
removeProperties
in interface Exchange
pattern
- pattern of namespublic boolean removeProperties(String pattern, String... excludePatterns)
Exchange
removeProperties
in interface Exchange
pattern
- pattern of names that should be removedexcludePatterns
- one or more pattern of properties names that should be excluded (= preserved)public Map<String,Object> getProperties()
Exchange
getProperties
in interface Exchange
public boolean hasProperties()
Exchange
hasProperties
in interface Exchange
public Message getIn()
Exchange
public <T> T getIn(Class<T> type)
Exchange
public void setIn(Message in)
Exchange
public Message getOut()
Exchange
Important: If you want to change the current message, then use Exchange.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 Exchange.hasOut()
method.
See also the class java doc for this Exchange
for more details and this
FAQ entry.
getOut
in interface Exchange
Exchange.getIn()
public <T> T getOut(Class<T> type)
Exchange
Important: If you want to change the current message, then use Exchange.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 Exchange.hasOut()
method.
See also the class java doc for this Exchange
for more details and this
FAQ entry.
getOut
in interface Exchange
type
- the given typeExchange.getIn(Class)
public boolean hasOut()
Exchange
public void setOut(Message out)
Exchange
public Exception getException()
Exchange
getException
in interface Exchange
public <T> T getException(Class<T> type)
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.
getException
in interface Exchange
type
- the exception typepublic void setException(Throwable t)
Exchange
Camel will wrap Throwable
into Exception
type to
accommodate for the Exchange.getException()
method returning a plain Exception
type.
setException
in interface Exchange
t
- the caused exceptionpublic ExchangePattern getPattern()
Exchange
ExchangePattern
(MEP) of this exchange.getPattern
in interface Exchange
public void setPattern(ExchangePattern pattern)
Exchange
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.setPattern
in interface Exchange
pattern
- the patternpublic Endpoint getFromEndpoint()
Exchange
getFromEndpoint
in interface Exchange
public void setFromEndpoint(Endpoint fromEndpoint)
Exchange
Endpoint
implementationssetFromEndpoint
in interface Exchange
fromEndpoint
- the endpoint which is originating this message exchangepublic String getFromRouteId()
Exchange
getFromRouteId
in interface Exchange
public void setFromRouteId(String fromRouteId)
Exchange
setFromRouteId
in interface Exchange
fromRouteId
- the from route idpublic String getExchangeId()
Exchange
getExchangeId
in interface Exchange
public void setExchangeId(String id)
Exchange
setExchangeId
in interface Exchange
public boolean isFailed()
Exchange
isFailed
in interface Exchange
Exchange.getException()
,
Message.setFault(boolean)
,
Message.isFault()
public boolean isTransacted()
Exchange
isTransacted
in interface Exchange
public Boolean isExternalRedelivered()
Exchange
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.
isExternalRedelivered
in interface Exchange
public boolean isRollbackOnly()
Exchange
isRollbackOnly
in interface Exchange
public UnitOfWork getUnitOfWork()
Exchange
getUnitOfWork
in interface Exchange
public void setUnitOfWork(UnitOfWork unitOfWork)
Exchange
setUnitOfWork
in interface Exchange
public void addOnCompletion(Synchronization onCompletion)
Exchange
Synchronization
to be invoked as callback when
this exchange is completed.addOnCompletion
in interface Exchange
onCompletion
- the callback to invoke on completion of this exchangepublic boolean containsOnCompletion(Synchronization onCompletion)
Exchange
Synchronization
instance is
already contained on this exchange.containsOnCompletion
in interface Exchange
onCompletion
- the callback instance that is being checked forpublic void handoverCompletions(Exchange target)
Exchange
handoverCompletions
in interface Exchange
target
- the target exchangepublic List<Synchronization> handoverCompletions()
Exchange
handoverCompletions
in interface Exchange
protected void configureMessage(Message message)
protected String createExchangeId()
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.