public class Enricher extends ServiceSupport implements AsyncProcessor, IdAware, CamelContextAware
producer
and second by aggregating input data and additional data. Aggregation of
input data and additional data is delegated to an AggregationStrategy
object.
Uses a Producer to obtain the additional data as opposed to PollEnricher
that uses a PollingConsumer.PollEnrichershutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending| Constructor and Description |
|---|
Enricher(Expression expression) |
| Modifier and Type | Method and Description |
|---|---|
protected Exchange |
createResourceExchange(Exchange source,
ExchangePattern pattern)
Creates a new
DefaultExchange instance from the given
exchange. |
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
AggregationStrategy |
getAggregationStrategy() |
int |
getCacheSize() |
CamelContext |
getCamelContext()
Get the
CamelContext |
EndpointUtilizationStatistics |
getEndpointUtilizationStatistics() |
Expression |
getExpression() |
String |
getId()
Returns the id
|
boolean |
isAggregateOnException() |
boolean |
isIgnoreInvalidEndpoint() |
boolean |
isShareUnitOfWork() |
void |
process(Exchange exchange)
Processes the message exchange
|
boolean |
process(Exchange exchange,
AsyncCallback callback)
Enriches the input data (
exchange) by first obtaining
additional data from an endpoint represented by an endpoint
producer and second by aggregating input data and additional
data. |
protected Endpoint |
resolveEndpoint(Exchange exchange,
Object recipient) |
void |
setAggregateOnException(boolean aggregateOnException) |
void |
setAggregationStrategy(AggregationStrategy aggregationStrategy) |
void |
setCacheSize(int cacheSize) |
void |
setCamelContext(CamelContext camelContext)
Injects the
CamelContext |
void |
setId(String id)
Sets the id
|
void |
setIgnoreInvalidEndpoint(boolean ignoreInvalidEndpoint) |
void |
setShareUnitOfWork(boolean shareUnitOfWork) |
String |
toString() |
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendpublic Enricher(Expression expression)
public CamelContext getCamelContext()
CamelContextAwareCamelContextgetCamelContext in interface CamelContextAwarepublic void setCamelContext(CamelContext camelContext)
CamelContextAwareCamelContextsetCamelContext in interface CamelContextAwarecamelContext - the Camel contextpublic Expression getExpression()
public EndpointUtilizationStatistics getEndpointUtilizationStatistics()
public void setAggregationStrategy(AggregationStrategy aggregationStrategy)
public AggregationStrategy getAggregationStrategy()
public boolean isAggregateOnException()
public void setAggregateOnException(boolean aggregateOnException)
public boolean isShareUnitOfWork()
public void setShareUnitOfWork(boolean shareUnitOfWork)
public int getCacheSize()
public void setCacheSize(int cacheSize)
public boolean isIgnoreInvalidEndpoint()
public void setIgnoreInvalidEndpoint(boolean ignoreInvalidEndpoint)
public void process(Exchange exchange) throws Exception
Processorpublic boolean process(Exchange exchange, AsyncCallback callback)
exchange) by first obtaining
additional data from an endpoint represented by an endpoint
producer and second by aggregating input data and additional
data. Aggregation of input data and additional data is delegated to an
AggregationStrategy object set at construction time. If the
message exchange with the resource endpoint fails then no aggregation
will be done and the failed exchange content is copied over to the
original message exchange.process in interface AsyncProcessorexchange - input data.callback - the AsyncCallback will be invoked when the processing of the exchange is completed.
If the exchange is completed synchronously, then the callback is also invoked synchronously.
The callback should therefore be careful of starting recursive loop.protected Endpoint resolveEndpoint(Exchange exchange, Object recipient)
protected Exchange createResourceExchange(Exchange source, ExchangePattern pattern)
DefaultExchange instance from the given
exchange. The resulting exchange's pattern is defined by
pattern.source - exchange to copy from.pattern - exchange pattern to set.protected void doStart() throws Exception
ServiceSupportServiceSupport.doStop() for more details.doStart in class ServiceSupportExceptionServiceSupport.doStop()protected void doStop() throws Exception
ServiceSupportServiceSupport.doStop() method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext is shutting down.doStop in class ServiceSupportExceptionServiceSupport.doStart()Apache Camel