0
votes

I am using Kafka producer to publish messages to some other kafka topic and its working pretty fine. sample template below:

<int-kafka:outbound-channel-adapter 
                kafka-template="template" 
                channel="inputToKafka"
                topic="foo"/>

Does the above statement support errorchannel as supported in kafka message driven inbound channel adapter?

I needed that to audit the error count whenever my outgoing kafka server is down and i am unable to publish it.

1

1 Answers

1
votes

Since any Outbound is passive component and it can only do its purpose by the external call, that is not a surprise that the error handling should be similar to the try...catch in Java when we call service method.

So, one way is to have error channel upstream - Messaging Gateway or Inbound channel Adapter.

Another way is to use ExpressionEvaluatingRequestHandlerAdvice in the request-handler-advice-chain of the <int-kafka:outbound-channel-adapter>.

Also, bear in mind that you should use async = false option to get all the errors from Kafka interaction in the same thread.