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, Optional<AssociationConfig> keyAssociation, Optional<AssociationConfig> valueAssociation)
extends Record
Result of any Odyssey operation (validation, association creation, fetch, etc.).
This class encapsulates the outcome of interactions with the Odyssey/Schema Registry service, including success/failure status, error codes, messages, and optionally fetched association data.
For mutation operations (validate, createAssociations), only success/failure and error fields are populated — association data fields remain empty. For read operations (fetchAssociations), successful results include the fetched key/value association data.
-
Constructor Summary
ConstructorsConstructorDescriptionOdysseyResult(boolean isSuccess, int errorCode, short kafkaErrorCode, Optional<String> errorMessage, boolean isIdempotent, Optional<AssociationConfig> keyAssociation, Optional<AssociationConfig> valueAssociation) Creates an instance of aOdysseyResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic OdysseyResultclassified(int srErrorCode, String srMessage) Per-topic Schema Registry outcome classified by HTTP-status family (seeSchemaErrorClassifier): a4xxcaller fault (e.g.final 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.booleanReturns true if this result contains fetched association data (key or value).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.Returns the value of thekeyAssociationrecord component.static OdysseyResultstatic OdysseyResultsuccess()Creates a success result (mutation path — no association data).static OdysseyResultsuccess(boolean isIdempotent) Creates a success result with idempotent flag (mutation path).static OdysseyResultsuccessWithAssociations(Optional<AssociationConfig> keyAssociation, Optional<AssociationConfig> valueAssociation) Creates a success result with fetched association data (read path — DescribeConfigs).final StringtoString()Returns a string representation of this record class.Returns the value of thevalueAssociationrecord component.
-
Constructor Details
-
OdysseyResult
public OdysseyResult(boolean isSuccess, int errorCode, short kafkaErrorCode, Optional<String> errorMessage, boolean isIdempotent, Optional<AssociationConfig> keyAssociation, Optional<AssociationConfig> valueAssociation) 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 componentkeyAssociation- the value for thekeyAssociationrecord componentvalueAssociation- the value for thevalueAssociationrecord component
-
-
Method Details
-
success
Creates a success result (mutation path — no association data). -
success
Creates a success result with idempotent flag (mutation path).- Parameters:
isIdempotent- whether this was an idempotent success (e.g., association already existed)
-
successWithAssociations
public static OdysseyResult successWithAssociations(Optional<AssociationConfig> keyAssociation, Optional<AssociationConfig> valueAssociation) Creates a success result with fetched association data (read path — DescribeConfigs).- Parameters:
keyAssociation- the key association if present, or emptyvalueAssociation- the value association if present, or empty
-
failure
Creates a failure result.- Parameters:
errorCode- the Odyssey/Schema Registry error codekafkaErrorCode- the Kafka protocol error codeerrorMessage- the error message
-
classified
Per-topic Schema Registry outcome classified by HTTP-status family (seeSchemaErrorClassifier): a4xxcaller fault (e.g. an incompatible schema) keeps the SR-provided message (falling back to the genericINVALID_CONFIGtext when SR omits it) and maps toINVALID_CONFIG; a5xx/server fault redacts the message to the canonicalUNKNOWN_SERVER_ERRORtext so SR internals never reach the caller. The SR code is preserved inerrorCodeeither way (surfaced via the"Schema Error [<code>]:"prefix); the real cause must be logged by the caller. -
serverError
-
hasAssociations
public boolean hasAssociations()Returns true if this result contains fetched association data (key or value). Only meaningful for read operations (DescribeConfigs flow). -
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
-
keyAssociation
Returns the value of thekeyAssociationrecord component.- Returns:
- the value of the
keyAssociationrecord component
-
valueAssociation
Returns the value of thevalueAssociationrecord component.- Returns:
- the value of the
valueAssociationrecord component
-