Reputation: 1
I need to create a batch in spring batch in order to publish messages in Kafka and update the status of the sending in database. I am planning to use kafkaitemwriter which send the messages in asynchronous mode (correct me if I am wrong).
In this case how to ensure to receive all the callback (to update the status) before the end of the step, please? Can I use the listener to trace the result into database?
I am not able to find any documentation on the error handling of kafkaitemwriter.
Upvotes: 0
Views: 50
Reputation: 31710
yes, messages are sent asynchronously. But what callbacks are you referring to? If there is error at the time of flushing the buffer, the writer will fail with an exception, and this is where you can log errors with a ItemWriteListener#onWriteError
.
Upvotes: 0