asa
asa

Reputation: 111

Kafka Streams DSL retry logic (writing record back to topic)

When doing KStream - KTable left join i want to send the record back to the same topic if the right table doesn't match, X amount of seconds later.

Is this achievable with the DSL?

Upvotes: 0

Views: 458

Answers (1)

Matthias J. Sax
Matthias J. Sax

Reputation: 62285

I guess you could to a

KStream[] streams = stream.leftJoin(table,...).branch(...);
stream[1].transform(...).to("input-topic");

You use branch to put joined records into the first stream and non-joined records into the second stream. The second stream is piped into transform() that uses a state store to buffer those record, and you can send context.forward() them using punctuations with 5 second delay.

Upvotes: 4

Related Questions