I’m trying to convert the error message from a lister to not send the msg to DLQ, but my return topic with some minimum information. How can I do that?
I have a listener method that uses @RetryableTopic that works fine, but I can only use the information when it sends to dlq. I don’t want a dlq, but to send myself the information for another topic when it fails all the retries. Can someone help me?
@RetryableTopic(
attempts = 2,
backoff = @Backoff(delay = 2000L),
sameIntervalTopicReuseStrategy = SameIntervalTopicReuseStrategy.SINGLE_TOPIC,
kafkaTemplate = "requestProducerTemplate",
include = {RetryableException.class}
)
@KafkaListener(
topics = "listener",
groupId = "listener-group-id",
containerFactory = "myListenerContainerFactory"
)
public void listener(MyObject request) throws RetryableException {
throw new RetryableException("Retryable Failure");
}
// this is the method that I want to send back the response
private void transformAndRespons(MyObject request) {
myKafkaProducerService.sendError("Error: " + request.getId());
}