|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.impl.DefaultExchange
public class DefaultExchange
A default implementation of Exchange
Field Summary | |
---|---|
protected CamelContext |
context
|
Fields inherited from interface org.apache.camel.Exchange |
---|
AGGREGATED_COUNT, CHARSET_NAME, EXCEPTION_HANDLED_PROPERTY |
Constructor Summary | |
---|---|
DefaultExchange(CamelContext context)
|
|
DefaultExchange(CamelContext context,
ExchangePattern pattern)
|
|
DefaultExchange(DefaultExchange parent)
|
Method Summary | ||
---|---|---|
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 |
|
void |
copyFrom(Exchange exchange)
Copies the data into this exchange from the given exchange |
|
protected Message |
createFaultMessage()
Factory method to lazily create the FAULT message |
|
protected Message |
createInMessage()
Factory method used to lazily create the IN message |
|
protected Message |
createOutMessage()
Factory method to lazily create the OUT message |
|
CamelContext |
getContext()
Returns the container so that a processor can resolve endpoints from URIs |
|
Throwable |
getException()
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 |
|
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 |
isFailed()
Returns true if this exchange failed due to either an exception or fault |
|
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(Throwable exception)
Sets the exception associated with this exchange |
|
void |
setExchangeId(String id)
Set the exchange id |
|
void |
setFault(Message fault)
|
|
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 |
|
void |
throwException()
|
|
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(DefaultExchange parent)
Method Detail |
---|
public String toString()
toString
in class Object
public Exchange copy()
Exchange
copy
in interface Exchange
public void copyFrom(Exchange exchange)
Exchange
copyFrom
in interface Exchange
exchange
- is the source from which headers and messages will be copiedpublic Exchange newInstance()
Exchange
newInstance
in interface Exchange
public CamelContext getContext()
Exchange
getContext
in interface Exchange
public Object getProperty(String name)
Exchange
getProperty
in interface Exchange
name
- the name of the property
public <T> T getProperty(String name, Class<T> type)
Exchange
getProperty
in interface Exchange
name
- the name of the propertytype
- the type of the property
public 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 property
public Map<String,Object> getProperties()
Exchange
getProperties
in interface Exchange
public void setProperties(Map<String,Object> properties)
public Message getIn()
Exchange
getIn
in interface Exchange
public void setIn(Message in)
Exchange
setIn
in interface Exchange
in
- the inbound messagepublic Message getOut()
Exchange
#hasOut()
first
Starting with Camel 2.0.0 an out message could also represent a fault,
i.e. a persistent error at the application level (equivalent to faults
defines in some specifications like wsdl and jbi). You should use
#org.apache.camel.Message
} fault apis to get/set the fault
flag for the out message.
getOut
in interface Exchange
public Message getOut(boolean lazyCreate)
Exchange
getOut
in interface Exchange
lazyCreate
- true will lazy create the out message
public void setOut(Message out)
Exchange
setOut
in interface Exchange
out
- the outbound messagepublic Throwable getException()
Exchange
getException
in interface Exchange
public void setException(Throwable exception)
Exchange
setException
in interface Exchange
exception
- 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 void throwException() throws Exception
Exception
public Message getFault()
Exchange
getFault
in interface Exchange
public Message getFault(boolean lazyCreate)
Exchange
getFault
in interface Exchange
lazyCreate
- true will lazy create the fault message
public void setFault(Message fault)
public 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()
,
Exchange.getOut()
public boolean isTransacted()
Exchange
isTransacted
in interface Exchange
public UnitOfWork getUnitOfWork()
Exchange
getUnitOfWork
in interface Exchange
public void setUnitOfWork(UnitOfWork unitOfWork)
Exchange
setUnitOfWork
in interface Exchange
protected Message createInMessage()
protected Message createOutMessage()
protected Message createFaultMessage()
protected void configureMessage(Message message)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |