public interface OptimisticLockingAwareAggregationStrategy extends AggregationStrategy
AggregationStrategy
which gets a callback when the aggregated Exchange
fails to add
in the OptimisticLockingAggregationRepository
because of
an OptimisticLockingAggregationRepository.OptimisticLockingException
.
Please note that when aggregating Exchange
's to be careful not to modify and return the oldExchange
from the AggregationStrategy.aggregate(org.apache.camel.Exchange, org.apache.camel.Exchange)
method.
If you are using the default MemoryAggregationRepository this will mean you have modified the value of an object
already referenced/stored by the MemoryAggregationRepository. This makes it impossible for optimistic locking
to work correctly with the MemoryAggregationRepository.
You should instead return either the new newExchange
or a completely new instance of Exchange
. This
is due to the nature of how the underlying ConcurrentHashMap
performs CAS operations
on the value identity.ConcurrentHashMap
Modifier and Type | Method and Description |
---|---|
void |
onOptimisticLockFailure(Exchange oldExchange,
Exchange newExchange) |
aggregate
void onOptimisticLockFailure(Exchange oldExchange, Exchange newExchange)
Apache Camel