Class Exchanges
java.lang.Object
org.openehealth.ipf.platform.camel.core.util.Exchanges
Utility related to Camel
Exchange
s.- Author:
- Martin Krasser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
copyExchange
(Exchange source, Exchange target) static void
Copies the exchange's in-message to the out-message if the exchange pattern isExchangePattern.InOut
.static Exchange
createExchange
(CamelContext context, ExchangePattern pattern) Creates a newExchange
instance usingcontext
.static Exchange
createExchange
(Exchange source, ExchangePattern pattern) Creates a newExchange
instance from the givenexchange
.static Exception
extractException
(Exchange exchange) Extracts the exception handled while processing the given exchange (if any), and marks the exchange as non-failed.static Exception
extractException
(Exchange exchange, boolean cleanup) Extracts the exception handled while processing the given exchange (if any), and optionally marks the exchange as non-failed.static Message
prepareResult
(Exchange exchange) Returns the message where to write results.static ProducerTemplate
producerTemplate
(Exchange exchange) Creates aProducerTemplate
from the givenExchange
-
Constructor Details
-
Exchanges
public Exchanges()
-
-
Method Details
-
producerTemplate
Creates aProducerTemplate
from the givenExchange
- Parameters:
exchange
- message exchange.- Returns:
- a producer template.
-
prepareResult
Returns the message where to write results. This method copies the in-message to the out-message if the exchange is out-capable.- Parameters:
exchange
- message exchange.- Returns:
- result message.
-
createExchange
Creates a newExchange
instance from the givenexchange
. The resulting exchange's pattern is defined bypattern
.- Parameters:
source
- exchange to copy from.pattern
- exchange pattern to set.- Returns:
- created exchange.
-
createExchange
Creates a newExchange
instance usingcontext
. The resulting exchange's pattern is defined bypattern
.- Parameters:
context
- Camel context.pattern
- exchange pattern.- Returns:
- created exchange.
-
copyInput
Copies the exchange's in-message to the out-message if the exchange pattern isExchangePattern.InOut
.- Parameters:
exchange
- message exchange.
-
copyExchange
- Parameters:
source
- source exchange.target
- target exchange.
-
extractException
Extracts the exception handled while processing the given exchange (if any), and optionally marks the exchange as non-failed.- Parameters:
exchange
- Camel exchange, should be notnull
.cleanup
-true
iff the information about the occurred exception should be removed from the given exchange.- Returns:
- an
Exception
instance, ornull
when no exception was handled.
-
extractException
Extracts the exception handled while processing the given exchange (if any), and marks the exchange as non-failed.This method corresponds to
extractException(org.apache.camel.Exchange, boolean)
with the second parameter set totrue
.- Parameters:
exchange
- Camel exchange, should be notnull
.- Returns:
- an
Exception
instance, ornull
when no exception was handled.
-