public interface ErrantRecordReporter
SinkTask
can use to report problematic records (and their corresponding problems) as it
writes them through SinkTask.put(java.util.Collection)
.Modifier and Type | Method and Description |
---|---|
Future<Void> |
report(SinkRecord record,
Throwable error)
Report a problematic record and the corresponding error to be written to the sink
connector's dead letter queue (DLQ).
|
Future<Void> report(SinkRecord record, Throwable error)
This call is asynchronous and returns a Future
.
Invoking get()
on this future will block until the
record has been written or throw any exception that occurred while sending the record.
If you want to simulate a simple blocking call you can call the get()
method
immediately.
Connect guarantees that sink records reported through this reporter will be written to the error topic
before the framework calls the SinkTask.preCommit(java.util.Map)
method and therefore before
committing the consumer offsets. SinkTask implementations can use the Future when stronger guarantees
are required.
record
- the problematic record; may not be nullerror
- the error capturing the problem with the record; may not be nullConnectException
- if the error reporter and DLQ fails to write a reported record