public abstract class AbstractAggregator extends EIPEndpoint
Store. By default, we will use a simple
MemoryStore, but you can set your own StoreFactory to use other implementations.
TODO: distributed lock manager
TODO: persistent / transactional timer| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractAggregator.ClosedAggregateException
Error used to report that the aggregate has already been closed
|
lockManager, store, storeFactory, timerManager, wsdlExchangeTarget, wsdlResourcedefinition, description, endpoint, interfaceName, service, serviceUnit| Constructor and Description |
|---|
AbstractAggregator() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract boolean |
addMessage(java.lang.Object aggregate,
javax.jbi.messaging.NormalizedMessage message,
javax.jbi.messaging.MessageExchange exchange)
Add a newly received message to this aggregation
|
protected abstract void |
buildAggregate(java.lang.Object aggregate,
javax.jbi.messaging.NormalizedMessage message,
javax.jbi.messaging.MessageExchange exchange,
boolean timeout)
Fill the given JBI message with the aggregation result.
|
protected void |
closeAggregation(java.lang.String correlationId)
Mark an aggregation as closed
|
protected abstract java.lang.Object |
createAggregation(java.lang.String correlationID)
Creates a new empty aggregation.
|
org.apache.servicemix.store.StoreFactory |
getClosedAggregatesStoreFactory()
Access the currently configured
StoreFactory for storing closed aggregations |
protected abstract java.lang.String |
getCorrelationID(javax.jbi.messaging.MessageExchange exchange,
javax.jbi.messaging.NormalizedMessage message)
Retrieve the correlation ID of the given exchange
|
ExchangeTarget |
getTarget() |
protected abstract java.util.Date |
getTimeout(java.lang.Object aggregate)
Returns the date when the onTimeout method should be called if the aggregation is not completed yet,
or null if the aggregation has no timeout.
|
protected boolean |
isAggregationClosed(java.lang.String correlationId)
Check if the aggregation with the given correlation id is closed or not.
|
boolean |
isCopyAttachments() |
boolean |
isCopyProperties() |
boolean |
isReportClosedAggregatesAsErrors() |
boolean |
isReportErrors() |
boolean |
isReportTimeoutAsErrors() |
boolean |
isRescheduleTimeouts() |
boolean |
isSynchronous() |
protected void |
onTimeout(java.lang.String processCorrelationId,
java.lang.String correlationId,
org.apache.servicemix.timers.Timer timer) |
void |
process(javax.jbi.messaging.MessageExchange exchange) |
protected void |
processAsync(javax.jbi.messaging.MessageExchange exchange) |
protected void |
processSync(javax.jbi.messaging.MessageExchange exchange) |
protected void |
sendAggregate(java.lang.String processCorrelationId,
java.lang.String correlationId,
java.lang.Object aggregation,
boolean timeout,
boolean sync) |
void |
setClosedAggregatesStoreFactory(org.apache.servicemix.store.StoreFactory closedAggregatesStoreFactory)
Set a new
StoreFactory for creating the Store to hold closed aggregations. |
void |
setCopyAttachments(boolean copyAttachments)
Copy all attachments from the incoming messages to the aggregated
message.
|
void |
setCopyProperties(boolean copyProperties)
Copy all properties from the incoming messages to the aggregated
message.
|
void |
setReportClosedAggregatesAsErrors(boolean reportClosedAggregatesAsErrors)
Sets whether the aggregator should report errors on incoming exchanges received after a given
aggregate has been closed.
|
void |
setReportErrors(boolean reportErrors)
Sets whether the aggregator should report errors happening when sending the
aggregate on all exchanges that compose the aggregate.
|
void |
setReportTimeoutAsErrors(boolean reportTimeoutAsErrors)
Sets whether the aggregator should reports errors on incoming exchanges already received when
a timeout occurs.
|
void |
setRescheduleTimeouts(boolean rescheduleTimeouts)
Boolean flag controlling if aggregate timeouts are rescheduled each time a new message is added
to the aggregate.
|
void |
setSynchronous(boolean synchronous)
Boolean flag that Controls whether the aggregate (when ready) will be sent synchronously or not.
|
void |
setTarget(ExchangeTarget target)
The exchange target that will be used to send the aggregate to.
|
void |
start() |
chooseFirstEndpointWithDescriptor, copyAttachments, copyProperties, getDefinition, getDefinitionFromDescription, getDefinitionFromWsdlExchangeTarget, getDefinitionFromWsdlResource, getDescription, getDescriptionForExchangeTarget, getEndpointsForExchangeTarget, getLockManager, getStore, getStoreFactory, getTimerManager, getWsdlExchangeTarget, getWsdlResource, setLockManager, setStore, setStoreFactory, setTimerManager, setWsdlExchangeTarget, setWsdlResource, stopactivate, deactivate, getRole, processInOnly, processInOutdone, fail, getChannel, getContext, getExchangeFactory, send, sendSyncgetEndpoint, getInterfaceName, getKey, getService, getServiceUnit, isExchangeOkay, prepareExchange, setDefinition, setDescription, setEndpoint, setInterfaceName, setService, setServiceUnit, toString, validatepublic boolean isSynchronous()
public void setSynchronous(boolean synchronous)
false.synchronous - the synchronous to setpublic boolean isRescheduleTimeouts()
public void setRescheduleTimeouts(boolean rescheduleTimeouts)
false, the timeout will expire when the specified amount of
time elapsed after the first message is received for this aggregate. If true,
the timeout will expire when the specified amount of time elapsed after the last message is received.
The default value is false.rescheduleTimeouts - the rescheduleTimeouts to setpublic ExchangeTarget getTarget()
public void setTarget(ExchangeTarget target)
target - the target to setpublic boolean isCopyProperties()
public void setCopyProperties(boolean copyProperties)
true.copyProperties - public boolean isCopyAttachments()
public void setCopyAttachments(boolean copyAttachments)
true.copyAttachments - public boolean isReportErrors()
public void setReportErrors(boolean reportErrors)
false, meaning that if any error occur, this
error will be lost.
Note that if this flag is set to true, all exchanges received as part of a given aggregate
will be hold until the aggregate is sent and the DONE / ERROR status is received back.reportErrors - boolean indicating if errors should be reported back to consumerspublic boolean isReportClosedAggregatesAsErrors()
public void setReportClosedAggregatesAsErrors(boolean reportClosedAggregatesAsErrors)
false, meaning that such exchanges will be silently sent back
with a DONE status and discarded with respect to the aggregation process.reportClosedAggregatesAsErrors - boolean indicating if exchanges received for a
closed aggregates should be send back with an ERROR statuspublic void setReportTimeoutAsErrors(boolean reportTimeoutAsErrors)
false, meaning that such exchanges will be silently sent back
a DONE status.reportTimeoutAsErrors - boolean indicating if exchanges received prior to a
timeout should be sent back with an ERROR statuspublic boolean isReportTimeoutAsErrors()
protected void processSync(javax.jbi.messaging.MessageExchange exchange)
throws java.lang.Exception
processSync in class EIPEndpointjava.lang.Exceptionpublic org.apache.servicemix.store.StoreFactory getClosedAggregatesStoreFactory()
StoreFactory for storing closed aggregationspublic void setClosedAggregatesStoreFactory(org.apache.servicemix.store.StoreFactory closedAggregatesStoreFactory)
StoreFactory for creating the Store to hold closed aggregations.
If it hasn't been set, a simple MemoryStoreFactory will be used by default.closedAggregatesStoreFactory - protected void processAsync(javax.jbi.messaging.MessageExchange exchange)
throws java.lang.Exception
processAsync in class EIPEndpointjava.lang.Exceptionpublic void start()
throws java.lang.Exception
start in interface Endpointstart in class EIPEndpointjava.lang.Exceptionpublic void process(javax.jbi.messaging.MessageExchange exchange)
throws java.lang.Exception
process in interface Endpointprocess in class EIPEndpointjava.lang.Exceptionprotected void sendAggregate(java.lang.String processCorrelationId,
java.lang.String correlationId,
java.lang.Object aggregation,
boolean timeout,
boolean sync)
throws java.lang.Exception
java.lang.Exceptionprotected void onTimeout(java.lang.String processCorrelationId,
java.lang.String correlationId,
org.apache.servicemix.timers.Timer timer)
protected boolean isAggregationClosed(java.lang.String correlationId)
throws java.lang.Exception
correlationId - java.lang.Exceptionprotected void closeAggregation(java.lang.String correlationId)
throws java.lang.Exception
correlationId - java.lang.Exceptionprotected abstract java.lang.String getCorrelationID(javax.jbi.messaging.MessageExchange exchange,
javax.jbi.messaging.NormalizedMessage message)
throws java.lang.Exception
exchange - message - java.lang.Exceptionprotected abstract java.lang.Object createAggregation(java.lang.String correlationID)
throws java.lang.Exception
correlationID - java.lang.Exceptionprotected abstract java.util.Date getTimeout(java.lang.Object aggregate)
aggregate - protected abstract boolean addMessage(java.lang.Object aggregate,
javax.jbi.messaging.NormalizedMessage message,
javax.jbi.messaging.MessageExchange exchange)
throws java.lang.Exception
aggregate - message - exchange - true if the aggregate id completejava.lang.Exceptionprotected abstract void buildAggregate(java.lang.Object aggregate,
javax.jbi.messaging.NormalizedMessage message,
javax.jbi.messaging.MessageExchange exchange,
boolean timeout)
throws java.lang.Exception
aggregate - message - exchange - timeout - false if the aggregation has completed or true
if this aggregation has timed outjava.lang.ExceptionCopyright © 2005-2015 FuseSource. All Rights Reserved.