Package org.apache.camel
Interface ExchangeExtension
public interface ExchangeExtension
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddOnCompletion(Synchronization onCompletion) Adds aSynchronizationto be invoked as callback when this exchange is completed.booleancontainsOnCompletion(Synchronization onCompletion) Checks if the passedSynchronizationinstance is already contained on this exchange.voidcopyInternalProperties(Exchange target) To copy the internal properties from this exchange to the target exchangevoidCopy the safe copy properties from this exchange to the target exchangecreateCopyWithProperties(CamelContext context) Create a new exchange copied from this, with the context set to the given contextCallback used byConsumerif the consumer is completing the exchange processing with default behaviour.Whether the exchange has been handled by the error handler.Returns the endpoint which originated this message exchange.Gets the history node id (the current processor that will process the exchange)Gets the history node label (the current processor that will process the exchange)Gets the history node source:line-number where the node is located in the source code (the current processor that will process the exchange).<T> TgetInOrNull(Class<T> type) If there is an existing inbound message of the given type then return it as-is, otherwise return null.Gets the internal properties from this exchange.<T> TgetSafeCopyProperty(String key, Class<T> type) To get a property that was copied specially (thread safe with deep cloning).Handover all the on completions from this exchangevoidhandoverCompletions(Exchange target) Handover all the on completions from this exchange to the target exchange.booleanWhether the exchange has been handled by the error handler.booleanWhether the error handler handled flag has been set.booleanisExternalRedelivered(Message message) Returns true if this exchange is an external initiated redelivered message (such as a JMS broker).booleanReturns whether the exchange has been failure handedbooleanWhether the exchange was interrupted (InterruptException) during routing.booleanWhether the exchange is currently used as event notification.booleanWhether the exchange has exhausted (attempted all) its redeliveries and still failed.booleanReturns true if this exchange is marked for rollbackbooleanReturns true if this exchange is marked for rollback (only last transaction section)booleanReturns true if this exchange is marked to stop and not continue routing.booleanIs stream caching disabled on the given exchangevoidsetDefaultConsumerCallback(AsyncCallback callback) Callback used byConsumerif the consumer is completing the exchange processing with default behaviour.voidsetErrorHandlerHandled(Boolean errorHandlerHandled) Used to signal that this exchange has been handled by the error handler.voidsetFailureHandled(boolean failureHandled) Sets whether the exchange has been failure handledvoidsetFromEndpoint(Endpoint fromEndpoint) Sets the endpoint which originated this message exchange.voidsetFromRouteId(String fromRouteId) Sets the route id which originated this message exchange.voidsetHistoryNodeId(String historyNodeId) Sets the history node id (the current processor that will process the exchange)voidsetHistoryNodeLabel(String historyNodeLabel) Sets the history node label (the current processor that will process the exchange)voidsetHistoryNodeSource(String historyNodeSource) Sets the history node source:line-number where the node is located in the source code (the current processor that will process the exchange).voidsetInterruptable(boolean interruptable) To control whether the exchange can accept being interrupted currently.voidsetInterrupted(boolean interrupted) Used to signal that this exchange was interrupted (InterruptException) during routing.voidsetNotifyEvent(boolean notifyEvent) Sets whether the exchange is currently used as event notification and if so then this should not generate additional events.voidsetProperties(Map<String, Object> properties) Sets the properties on the exchangevoidsetRedeliveryExhausted(boolean redeliveryExhausted) Used to signal that this exchange has exhausted (attempted all) its redeliveries and still failed.voidsetRollbackOnly(boolean rollbackOnly) Sets whether to mark this exchange for rollbackvoidsetRollbackOnlyLast(boolean rollbackOnlyLast) Sets whether to mark this exchange for rollback (only last transaction section)voidsetRouteStop(boolean routeStop) Sets whether this exchange is marked to stop and not continue routing.voidsetSafeCopyProperty(String key, SafeCopyProperty value) To set a property that must be copied specially (thread safe with deep cloning).voidsetStreamCacheDisabled(boolean streamCacheDisabled) Used to force disabling stream caching which some components can do in special use-cases.voidsetTransacted(boolean transacted) Sets whether the exchange is routed in a transaction.voidsetUnitOfWork(UnitOfWork unitOfWork) Sets the unit of work that this exchange belongs to; which may map to zero, one or more physical transactions
-
Method Details
-
getInOrNull
If there is an existing inbound message of the given type then return it as-is, otherwise return null.- Parameters:
type- the given type- Returns:
- the message if exists with the given type, otherwise null.
-
setFromEndpoint
Sets the endpoint which originated this message exchange. This method should typically only be called byEndpointimplementations -
getFromEndpoint
Endpoint getFromEndpoint()Returns the endpoint which originated this message exchange. SeeExchange.getFromEndpoint()for details. -
setFromRouteId
Sets the route id which originated this message exchange. This method should typically only be called by the internal framework. -
setUnitOfWork
Sets the unit of work that this exchange belongs to; which may map to zero, one or more physical transactions -
isStreamCacheDisabled
boolean isStreamCacheDisabled()Is stream caching disabled on the given exchange -
setStreamCacheDisabled
void setStreamCacheDisabled(boolean streamCacheDisabled) Used to force disabling stream caching which some components can do in special use-cases. -
addOnCompletion
Adds aSynchronizationto be invoked as callback when this exchange is completed.- Parameters:
onCompletion- the callback to invoke on completion of this exchange
-
isErrorHandlerHandledSet
boolean isErrorHandlerHandledSet()Whether the error handler handled flag has been set. -
isErrorHandlerHandled
boolean isErrorHandlerHandled()Whether the exchange has been handled by the error handler. This is used internally by Camel.Important: Call
isErrorHandlerHandledSet()first before this method.- See Also:
-
getErrorHandlerHandled
Boolean getErrorHandlerHandled()Whether the exchange has been handled by the error handler. This is used internally by Camel. -
setErrorHandlerHandled
Used to signal that this exchange has been handled by the error handler. This is used internally by Camel. -
setInterruptable
void setInterruptable(boolean interruptable) To control whether the exchange can accept being interrupted currently. -
isInterrupted
boolean isInterrupted()Whether the exchange was interrupted (InterruptException) during routing. -
setInterrupted
void setInterrupted(boolean interrupted) Used to signal that this exchange was interrupted (InterruptException) during routing. -
isRedeliveryExhausted
boolean isRedeliveryExhausted()Whether the exchange has exhausted (attempted all) its redeliveries and still failed. This is used internally by Camel. -
setRedeliveryExhausted
void setRedeliveryExhausted(boolean redeliveryExhausted) Used to signal that this exchange has exhausted (attempted all) its redeliveries and still failed. This is used internally by Camel. -
containsOnCompletion
Checks if the passedSynchronizationinstance is already contained on this exchange.- Parameters:
onCompletion- the callback instance that is being checked for- Returns:
- true, if callback instance is already contained on this exchange, else false
-
handoverCompletions
Handover all the on completions from this exchange to the target exchange. -
handoverCompletions
List<Synchronization> handoverCompletions()Handover all the on completions from this exchange -
setProperties
Sets the properties on the exchange -
setHistoryNodeId
Sets the history node id (the current processor that will process the exchange) -
getHistoryNodeId
String getHistoryNodeId()Gets the history node id (the current processor that will process the exchange) -
getHistoryNodeSource
String getHistoryNodeSource()Gets the history node source:line-number where the node is located in the source code (the current processor that will process the exchange). -
setHistoryNodeSource
Sets the history node source:line-number where the node is located in the source code (the current processor that will process the exchange). -
getHistoryNodeLabel
String getHistoryNodeLabel()Gets the history node label (the current processor that will process the exchange) -
setHistoryNodeLabel
Sets the history node label (the current processor that will process the exchange) -
isNotifyEvent
boolean isNotifyEvent()Whether the exchange is currently used as event notification. -
setNotifyEvent
void setNotifyEvent(boolean notifyEvent) Sets whether the exchange is currently used as event notification and if so then this should not generate additional events. -
isRollbackOnly
boolean isRollbackOnly()Returns true if this exchange is marked for rollback -
setRollbackOnly
void setRollbackOnly(boolean rollbackOnly) Sets whether to mark this exchange for rollback -
isRollbackOnlyLast
boolean isRollbackOnlyLast()Returns true if this exchange is marked for rollback (only last transaction section) -
setRollbackOnlyLast
void setRollbackOnlyLast(boolean rollbackOnlyLast) Sets whether to mark this exchange for rollback (only last transaction section) -
isRouteStop
boolean isRouteStop()Returns true if this exchange is marked to stop and not continue routing. -
setRouteStop
void setRouteStop(boolean routeStop) Sets whether this exchange is marked to stop and not continue routing.- Parameters:
routeStop- true to stop routing
-
copyInternalProperties
To copy the internal properties from this exchange to the target exchange This method is only intended for Camel internally.- Parameters:
target- the target exchange
-
getSafeCopyProperty
To get a property that was copied specially (thread safe with deep cloning).- See Also:
-
setSafeCopyProperty
To set a property that must be copied specially (thread safe with deep cloning).- See Also:
-
copySafeCopyPropertiesTo
Copy the safe copy properties from this exchange to the target exchange -
getInternalProperties
Gets the internal properties from this exchange. The known set of internal keys is defined inExchangePropertyKey. This method is only intended for Camel internally.- Returns:
- all the internal properties in a Map
-
setTransacted
void setTransacted(boolean transacted) Sets whether the exchange is routed in a transaction. -
getDefaultConsumerCallback
AsyncCallback getDefaultConsumerCallback()Callback used byConsumerif the consumer is completing the exchange processing with default behaviour.This is only used when pooled exchange is enabled for optimization and reducing object allocations.
-
setDefaultConsumerCallback
Callback used byConsumerif the consumer is completing the exchange processing with default behaviour.This is only used when pooled exchange is enabled for optimization and reducing object allocations.
-
isFailureHandled
boolean isFailureHandled()Returns whether the exchange has been failure handed- Returns:
- true if failure handled or false otherwise
-
setFailureHandled
void setFailureHandled(boolean failureHandled) Sets whether the exchange has been failure handled- Parameters:
failureHandled- true if failure handled or false otherwise
-
createCopyWithProperties
Create a new exchange copied from this, with the context set to the given context- Parameters:
context- the context associated with the new exchange- Returns:
- A new Exchange instance
-
isExternalRedelivered
Returns true if this exchange is an external initiated redelivered message (such as a JMS broker). Important: It is not always possible to determine if the message is a redelivery or not, and therefore false is returned. Such an example would be a JDBC message. However JMS brokers provides details if a message is redelivered.- Parameters:
message- the camel message- Returns:
- true if redelivered, false if not or not able to determine
-