Record Class SagaCancellationPolicy
java.lang.Object
java.lang.Record
org.j7m.middleware.api.saga.SagaCancellationPolicy
- Record Components:
compensateOnCancel- whether successful steps are compensated after cancellationcancelRunningStep- whether the currently running step may be marked cancelled
- All Implemented Interfaces:
Serializable
public record SagaCancellationPolicy(boolean compensateOnCancel, boolean cancelRunningStep)
extends Record
implements Serializable
Saga cancellation behavior.
The policy determines whether already successful steps are compensated and whether an implementation may mark a running step as cancelled. It does not interrupt arbitrary external systems.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSagaCancellationPolicy(boolean compensateOnCancel, boolean cancelRunningStep) Creates an instance of aSagaCancellationPolicyrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecancelRunningSteprecord component.static SagaCancellationPolicyReturns the default cancellation policy.booleanReturns the value of thecompensateOnCancelrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SagaCancellationPolicy
public SagaCancellationPolicy(boolean compensateOnCancel, boolean cancelRunningStep) Creates an instance of aSagaCancellationPolicyrecord class.- Parameters:
compensateOnCancel- the value for thecompensateOnCancelrecord componentcancelRunningStep- the value for thecancelRunningSteprecord component
-
-
Method Details
-
compensate
Returns the default cancellation policy.- Returns:
- policy that compensates completed steps and does not cancel a running step directly
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
compensateOnCancel
public boolean compensateOnCancel()Returns the value of thecompensateOnCancelrecord component.- Returns:
- the value of the
compensateOnCancelrecord component
-
cancelRunningStep
public boolean cancelRunningStep()Returns the value of thecancelRunningSteprecord component.- Returns:
- the value of the
cancelRunningSteprecord component
-