public interface CompensationContext
Modifier and Type | Method and Description |
---|---|
void |
resetCompensation()
Signify that the command does not need the compensation data which has been recorded up to this point, and if an
error occurs after this point then compensation will handle only the entities which were snapshot after this
point.
|
void |
snapshotEntity(BusinessEntity<?> entity)
Save a snapshot of the entire entity before it is changed/deleted in the DB, so that it can be restored later on
in case of compensation.
|
void |
snapshotEntityStatus(BusinessEntity<?> entity,
Enum<?> status)
Snapshot the entity status only, so that in case of compensation for the entity, the status will be updated to
it's original value.
|
void |
snapshotNewEntity(BusinessEntity<?> entity)
Save a snapshot of a new entity that was added to the DB, so that if there's need for compensation it will be
deleted from the DB.
|
void |
stateChanged()
Signify that the command state had changed and the transaction is about to end, so that the snapshots can
be saved to the DB (in order to reduce lock time on the compensations table).
|
void snapshotEntity(BusinessEntity<?> entity)
entity
- The entity state before the change.void snapshotNewEntity(BusinessEntity<?> entity)
entity
- The new entity which was added.void snapshotEntityStatus(BusinessEntity<?> entity, Enum<?> status)
entity
- The entity for which to save the status snapshot.status
- The status to snapshot.void stateChanged()
void resetCompensation()
Copyright © 2012. All Rights Reserved.