Record Class ColumnarErrorPolicy
- Record Components:
action- what to do with the failed batchdeadLetterTopic- the topic failed records are forwarded to; non-null exactly when the action isColumnarErrorPolicy.Action.DEAD_LETTER
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());
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe reaction to a failed partition batch. -
Constructor Summary
ConstructorsConstructorDescriptionColumnarErrorPolicy(ColumnarErrorPolicy.Action action, String deadLetterTopic) Validates the action and dead-letter topic combination. -
Method Summary
Modifier and TypeMethodDescriptionaction()Returns the value of theactionrecord component.static ColumnarErrorPolicydeadLetter(String topic) Returns the policy that forwards failed batches to a dead-letter topic.Returns the value of thedeadLetterTopicrecord component.final booleanIndicates whether some other object is "equal to" this one.static ColumnarErrorPolicyfail()Returns the policy that rethrows failures.final inthashCode()Returns a hash code value for this object.static ColumnarErrorPolicyskip()Returns the policy that skips failed batches.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ColumnarErrorPolicy
Validates the action and dead-letter topic combination.- Parameters:
action- what to do with the failed batchdeadLetterTopic- the topic failed records are forwarded to, or null- Throws:
NullPointerException- ifactionis null, or the action isColumnarErrorPolicy.Action.DEAD_LETTERanddeadLetterTopicis nullIllegalArgumentException- if a dead-letter topic is supplied for another action
-
-
Method Details
-
fail
Returns the policy that rethrows failures.- Returns:
- the fail-fast policy
-
skip
Returns the policy that skips failed batches.- Returns:
- the skip policy
-
deadLetter
Returns the policy that forwards failed batches to a dead-letter topic.- Parameters:
topic- the dead-letter topic- Returns:
- the dead-letter policy
-
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 withObjects::equals(Object,Object). -
action
-
deadLetterTopic
Returns the value of thedeadLetterTopicrecord component.- Returns:
- the value of the
deadLetterTopicrecord component
-