public class CamelExchangeAdapter
extends java.lang.Object
Exchange
to and from CamelMessage
and FailureResult
objects.
The org.apache.camel.Message is mutable and not suitable to be used directly as messages between Actors.
This adapter is used to convert to immutable messages to be used with Actors, and convert the immutable messages back
to org.apache.camel.Message when using Camel.Constructor and Description |
---|
CamelExchangeAdapter(org.apache.camel.Exchange exchange) |
Modifier and Type | Method and Description |
---|---|
org.apache.camel.Exchange |
exchange() |
java.lang.String |
getExchangeId()
Returns the exchange id
|
boolean |
isOutCapable()
Returns if the exchange is out capable.
|
void |
setFailure(FailureResult msg)
Sets Exchange.getException from the given FailureResult message.
|
void |
setRequest(CamelMessage msg)
Sets Exchange.getIn from the given CamelMessage object.
|
void |
setResponse(CamelMessage msg)
Depending on the exchange pattern, sets Exchange.getIn or Exchange.getOut from the given
CamelMessage object.
|
AkkaCamelException |
toAkkaCamelException()
Creates an AkkaCamelException object from the adapted Exchange.
|
AkkaCamelException |
toAkkaCamelException(scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
Creates an AkkaCamelException object from the adapted Exchange.
|
FailureResult |
toFailureMessage()
Creates an immutable Failure object from the adapted Exchange so it can be used internally between Actors.
|
FailureResult |
toFailureResult(scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
Creates an immutable FailureResult object from the adapted Exchange so it can be used internally between Actors.
|
CamelMessage |
toRequestMessage()
Creates an immutable CamelMessage object from Exchange.getIn so it can be used with Actors.
|
CamelMessage |
toRequestMessage(scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
Creates an immutable CamelMessage object from Exchange.getIn so it can be used with Actors.
|
CamelMessage |
toResponseMessage()
Depending on the exchange pattern, creates an immutable CamelMessage object from Exchange.getIn or Exchange.getOut so it can be used with Actors.
|
CamelMessage |
toResponseMessage(scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
Depending on the exchange pattern, creates an immutable CamelMessage object from Exchange.getIn or Exchange.getOut so it can be used with Actors.
|
public CamelExchangeAdapter(org.apache.camel.Exchange exchange)
public org.apache.camel.Exchange exchange()
public java.lang.String getExchangeId()
public boolean isOutCapable()
public void setRequest(CamelMessage msg)
msg
- (undocumented)public void setResponse(CamelMessage msg)
msg
- (undocumented)public void setFailure(FailureResult msg)
msg
- (undocumented)public CamelMessage toRequestMessage()
public CamelMessage toResponseMessage()
public AkkaCamelException toAkkaCamelException()
Depending on the exchange pattern, puts the headers from Exchange.getIn or Exchange.getOut on the AkkaCamelException.
If the exchange is out-capable then the headers of Exchange.getOut are used, otherwise the headers of Exchange.getIn are used.
public AkkaCamelException toAkkaCamelException(scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
Depending on the exchange pattern, adds the supplied headers and the headers from Exchange.getIn or Exchange.getOut together and passes these to the AkkaCamelException.
If the exchange is out-capable then the headers of Exchange.getOut are used, otherwise the headers of Exchange.getIn are used.
headers
- additional headers to set on the exception in addition to those
in the exchange.public FailureResult toFailureMessage()
public FailureResult toFailureResult(scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
headers
- additional headers to set on the created CamelMessage in addition to those
in the Camel message.public CamelMessage toRequestMessage(scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
headers
- additional headers to set on the created CamelMessage in addition to those
in the Camel message.public CamelMessage toResponseMessage(scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
headers
- additional headers to set on the created CamelMessage in addition to those
in the Camel message.