|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.camel.impl.DefaultExchange
public final class DefaultExchange
A default implementation of Exchange
| Field Summary | |
|---|---|
protected CamelContext |
context
|
| Constructor Summary | |
|---|---|
DefaultExchange(CamelContext context)
|
|
DefaultExchange(CamelContext context,
ExchangePattern pattern)
|
|
DefaultExchange(Endpoint fromEndpoint)
|
|
DefaultExchange(Endpoint fromEndpoint,
ExchangePattern pattern)
|
|
DefaultExchange(Exchange parent)
|
|
| Method Summary | ||
|---|---|---|
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 |
|
Exchange |
copy()
Creates a copy of the current message exchange so that it can be forwarded to another destination |
|
Exchange |
copy(boolean handoverOnCompletion)
Creates a new instance and copies from the current message exchange so that it can be forwarded to another destination as a new instance. |
|
void |
copyFrom(Exchange exchange)
Copies the data into this exchange from the given exchange |
|
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 |
|
|
getException(Class<T> type)
Returns the exception associated with this exchange. |
|
String |
getExchangeId()
Returns the exchange id (unique) |
|
Message |
getFault()
Returns the fault message |
|
Message |
getFault(boolean lazyCreate)
Returns the fault message; optionally lazily creating one if one has not been associated with this exchange |
|
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 |
|
Message |
getIn()
Returns the inbound request message |
|
Message |
getOut()
Returns the outbound message, lazily creating one if one has not already been associated with this exchange. |
|
Message |
getOut(boolean lazyCreate)
Returns the outbound message; optionally lazily creating one if one has not been associated with this exchange |
|
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 |
|
|
getProperty(String name,
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 |
|
boolean |
hasFault()
Returns whether a FAULT message has been set or not. |
|
boolean |
hasOut()
Returns whether an OUT message has been set or not. |
|
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 |
|
Exchange |
newInstance()
Creates a new exchange instance with empty messages, headers and properties |
|
Object |
removeProperty(String name)
Removes the given property on the exchange |
|
void |
setException(Exception exception)
Sets the exception associated with this exchange |
|
void |
setExchangeId(String id)
Set the exchange id |
|
void |
setFault(Message fault)
Sets the fault message |
|
void |
setFromEndpoint(Endpoint fromEndpoint)
Sets the endpoint 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()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final CamelContext context
| Constructor Detail |
|---|
public DefaultExchange(CamelContext context)
public DefaultExchange(CamelContext context,
ExchangePattern pattern)
public DefaultExchange(Exchange parent)
public DefaultExchange(Endpoint fromEndpoint)
public DefaultExchange(Endpoint fromEndpoint,
ExchangePattern pattern)
| Method Detail |
|---|
public String toString()
toString in class Objectpublic Exchange copy()
Exchange
copy in interface Exchangepublic Exchange copy(boolean handoverOnCompletion)
ExchangeUnitOfWork so its should be used
for async messaging, where the original and copied exchange are independent.
copy in interface ExchangehandoverOnCompletion - whether the on completion callbacks should be handed over to the new copy.public void copyFrom(Exchange exchange)
Exchange
copyFrom in interface Exchangeexchange - is the source from which headers and messages will be copiedpublic Exchange newInstance()
Exchange
newInstance in interface Exchangepublic CamelContext getContext()
Exchange
getContext in interface Exchangepublic Object getProperty(String name)
Exchange
getProperty in interface Exchangename - the name of the property
public <T> T getProperty(String name,
Class<T> type)
Exchange
getProperty in interface Exchangename - the name of the propertytype - the type of the property
public void setProperty(String name,
Object value)
Exchange
setProperty in interface Exchangename - of the propertyvalue - to associate with the namepublic Object removeProperty(String name)
Exchange
removeProperty in interface Exchangename - of the property
public Map<String,Object> getProperties()
Exchange
getProperties in interface Exchangepublic void setProperties(Map<String,Object> properties)
public Message getIn()
Exchange
getIn in interface Exchangepublic void setIn(Message in)
Exchange
setIn in interface Exchangein - the inbound messagepublic Message getOut()
ExchangeExchange.hasOut() method.
getOut in interface Exchangepublic boolean hasOut()
Exchange
hasOut in interface Exchangepublic Message getOut(boolean lazyCreate)
Exchange
getOut in interface ExchangelazyCreate - true will lazy create the out message
public void setOut(Message out)
Exchange
setOut in interface Exchangeout - the outbound messagepublic Exception getException()
Exchange
getException in interface Exchangepublic <T> T getException(Class<T> type)
Exchange
getException in interface Exchangetype - the exception type
public void setException(Exception exception)
Exchange
setException in interface Exchangeexception - the caused exceptionpublic ExchangePattern getPattern()
ExchangeExchangePattern (MEP) of this exchange.
getPattern in interface Exchangepublic void setPattern(ExchangePattern pattern)
ExchangeExchangePattern (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 Exchangepattern - the patternpublic Endpoint getFromEndpoint()
Exchange
getFromEndpoint in interface Exchangepublic void setFromEndpoint(Endpoint fromEndpoint)
ExchangeEndpoint implementations
setFromEndpoint in interface ExchangefromEndpoint - the endpoint which is originating this message exchangepublic boolean hasFault()
Exchange
hasFault in interface Exchangepublic Message getFault()
Exchange
getFault in interface Exchangepublic Message getFault(boolean lazyCreate)
Exchange
getFault in interface ExchangelazyCreate - true will lazy create the fault message
public void setFault(Message fault)
Exchange
setFault in interface Exchangefault - the fault messagepublic String getExchangeId()
Exchange
getExchangeId in interface Exchangepublic void setExchangeId(String id)
Exchange
setExchangeId in interface Exchangepublic boolean isFailed()
Exchange
isFailed in interface ExchangeExchange.getException(),
Exchange.getFault()public boolean isTransacted()
Exchange
isTransacted in interface Exchangepublic boolean isRollbackOnly()
Exchange
isRollbackOnly in interface Exchangepublic UnitOfWork getUnitOfWork()
Exchange
getUnitOfWork in interface Exchangepublic void setUnitOfWork(UnitOfWork unitOfWork)
Exchange
setUnitOfWork in interface Exchangepublic void addOnCompletion(Synchronization onCompletion)
ExchangeSynchronization to be invoked as callback when
this exchange is completed.
addOnCompletion in interface ExchangeonCompletion - the callback to invoke on completion of this exchangeprotected void configureMessage(Message message)
protected String createExchangeId()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||