Record Class ColumnarErrorPolicy

java.lang.Object
java.lang.Record
io.krabka.streams.columnar.ColumnarErrorPolicy
Record Components:
action - what to do with the failed batch
deadLetterTopic - the topic failed records are forwarded to; non-null exactly when the action is ColumnarErrorPolicy.Action.DEAD_LETTER

public record ColumnarErrorPolicy(ColumnarErrorPolicy.Action action, String deadLetterTopic) extends Record
Selects how a group runner handles a failed logical partition batch.

When processing one partition's poll fails, the runner first rolls that partition's operator state back to its pre-batch snapshot, then applies the policy: ColumnarErrorPolicy.Action.FAIL rethrows, ColumnarErrorPolicy.Action.SKIP commits past the poisoned batch without producing output for it, and ColumnarErrorPolicy.Action.DEAD_LETTER additionally forwards each input record to the dead-letter topic with krabka.error.* and krabka.source.* headers describing the failure and origin.

A RetriableException — thrown directly or anywhere in the failure's cause chain, as with the schema cache's SchemaFetchPendingException wrapped by a serde — is always rethrown regardless of the policy: a transient condition clears on retry, so skipping or dead-lettering the batch would discard healthy records.

Example

var runner = ColumnarRunner.group(
    topology, consumer, producer,
    ColumnarErrorPolicy.deadLetter("transactions-dead-letter"),
    ColumnarStateStore.none(),
    new ColumnarMetrics());
  • Constructor Details

  • Method Details

    • fail

      public static ColumnarErrorPolicy fail()
      Returns the policy that rethrows failures.
      Returns:
      the fail-fast policy
    • skip

      public static ColumnarErrorPolicy skip()
      Returns the policy that skips failed batches.
      Returns:
      the skip policy
    • deadLetter

      public static ColumnarErrorPolicy deadLetter(String topic)
      Returns the policy that forwards failed batches to a dead-letter topic.
      Parameters:
      topic - the dead-letter topic
      Returns:
      the dead-letter policy
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • action

      public ColumnarErrorPolicy.Action action()
      Returns the value of the action record component.
      Returns:
      the value of the action record component
    • deadLetterTopic

      public String deadLetterTopic()
      Returns the value of the deadLetterTopic record component.
      Returns:
      the value of the deadLetterTopic record component