Record Class OdysseyResult
java.lang.Object
java.lang.Record
io.confluent.kafka.odyssey.OdysseyResult
public record OdysseyResult(boolean isSuccess, int errorCode, short kafkaErrorCode, Optional<String> errorMessage, boolean isIdempotent)
extends Record
Result of any Odyssey operation (validation, association creation, etc.).
This class encapsulates the outcome of interactions with the Odyssey/Schema Registry service,
including success/failure status, error codes, and messages.
-
Constructor Summary
ConstructorsConstructorDescriptionOdysseyResult(boolean isSuccess, int errorCode, short kafkaErrorCode, Optional<String> errorMessage, boolean isIdempotent) Creates an instance of aOdysseyResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.intReturns the value of theerrorCoderecord component.Returns the value of theerrorMessagerecord component.static OdysseyResultCreates a failure result.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theisIdempotentrecord component.booleanReturns the value of theisSuccessrecord component.shortReturns the value of thekafkaErrorCoderecord component.static OdysseyResultsuccess()Creates a success result.static OdysseyResultsuccess(boolean isIdempotent) Creates a success result with idempotent flag.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
OdysseyResult
public OdysseyResult(boolean isSuccess, int errorCode, short kafkaErrorCode, Optional<String> errorMessage, boolean isIdempotent) Creates an instance of aOdysseyResultrecord class.- Parameters:
isSuccess- the value for theisSuccessrecord componenterrorCode- the value for theerrorCoderecord componentkafkaErrorCode- the value for thekafkaErrorCoderecord componenterrorMessage- the value for theerrorMessagerecord componentisIdempotent- the value for theisIdempotentrecord component
-
-
Method Details
-
success
-
success
Creates a success result with idempotent flag.- Parameters:
isIdempotent- whether this was an idempotent success (e.g., association already existed)- Returns:
- a successful OdysseyResult
-
failure
Creates a failure result.- Parameters:
errorCode- the Odyssey/Schema Registry error codekafkaErrorCode- the Kafka protocol error codeerrorMessage- the error message- Returns:
- a failed OdysseyResult
-
errorMessage
-
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. -
isSuccess
public boolean isSuccess()Returns the value of theisSuccessrecord component.- Returns:
- the value of the
isSuccessrecord component
-
errorCode
public int errorCode()Returns the value of theerrorCoderecord component.- Returns:
- the value of the
errorCoderecord component
-
kafkaErrorCode
public short kafkaErrorCode()Returns the value of thekafkaErrorCoderecord component.- Returns:
- the value of the
kafkaErrorCoderecord component
-
isIdempotent
public boolean isIdempotent()Returns the value of theisIdempotentrecord component.- Returns:
- the value of the
isIdempotentrecord component
-