Home:ALL Converter>Separate Dead letter queue for each topic in kafka connect

Separate Dead letter queue for each topic in kafka connect

Ask Time:2022-10-20T06:29:24         Author:Subba

Json Formatter

I'm implementing streaming using kafka connect in one of my projects. I have created S3 sink connector to consume messages from different topics (using regex) and then write a file to S3. Consuming messages from different topics is done using the below property.

"topics.regex": "my-topic-sample\\.(.+)",

I have 3 different topics as below. Using the above property, S3 sink connector will consume messages from these 3 topics and writes a separate file (for each topic) to S3.

my-topic-sample.test1
my-topic-sample.test2
my-topic-sample.test3

For now, ignoring all the invalid messages. However, want to implement dead letter queue.

We can achieve that using the below properties

'errors.tolerance'='all',
'errors.deadletterqueue.topic.name' = 'error_topic'

From the above property, we can move all the invalid messages to DLQ. But the issue is that we will have only 1 DLQ though there are 3 different topics from which S3 sink connector is consuming the messages. Invalid messages from all the 3 topics will be pushed to same DLQ.

Is there a way that we can have multiple DLQ's and write the message to a different DLQ based on the topic that was consumed from.

Thanks

Author:Subba,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/74132611/separate-dead-letter-queue-for-each-topic-in-kafka-connect
yy