org.apache.camel.processor.aggregate
Interface OptimisticLockingAwareAggregationStrategy
- All Superinterfaces:
- AggregationStrategy
public interface OptimisticLockingAwareAggregationStrategy
- extends AggregationStrategy
A specialized 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.
- Version:
- See Also:
ConcurrentHashMap
onOptimisticLockFailure
void onOptimisticLockFailure(Exchange oldExchange,
Exchange newExchange)
Apache Camel