Record Class SagaCompensationResult
java.lang.Object
java.lang.Record
org.j7m.middleware.api.saga.SagaCompensationResult
- Record Components:
success- whether compensation succeededretryable- whether a failed compensation may be retriedreasonCode- stable machine-readable result codemetadata- redacted result metadata
- All Implemented Interfaces:
Serializable
public record SagaCompensationResult(boolean success, boolean retryable, String reasonCode, Map<String,String> metadata)
extends Record
implements Serializable
Safe compensation result.
The result describes the outcome of an application-provided compensation action. It does not claim arbitrary external side effects were undone.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSagaCompensationResult(boolean success, boolean retryable, String reasonCode, Map<String, String> metadata) Creates a validated result. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static SagaCompensationResultReturns a failed compensation result.final inthashCode()Returns a hash code value for this object.metadata()Returns the value of themetadatarecord component.Returns the value of thereasonCoderecord component.booleanReturns the value of theretryablerecord component.static SagaCompensationResultReturns a successful compensation result.booleansuccess()Returns the value of thesuccessrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SagaCompensationResult
-
-
Method Details
-
succeeded
Returns a successful compensation result.- Returns:
- immutable success result
-
failed
Returns a failed compensation result.- Parameters:
reasonCode- stable failure reason coderetryable- whether retry policy may retry the failure- Returns:
- immutable failure result
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
success
-
retryable
-
reasonCode
Returns the value of thereasonCoderecord component.- Returns:
- the value of the
reasonCoderecord component
-
metadata
-