简体   繁体   中英

Payload of the ErrorMessage in ErrorChannel does not contain Kafka Topic

Following on from this question Messages DO NOT appear in the Spring Integration (Kafka) ErrorChannel when Broker is unavailable

I now have it working nicely and the spring integration Kafka default ErrorChannel is being called when there is an error state, with the associated ErrorMessage. My problem now, is that I need to determine the Topic of the message and there is no way to do this, other than including it in the Message Header .

What is the best approach for doing this - shall I create a special errorChannel that is associated with one and only one Topic?

The payload.failedMessage property of the error message is the original message that arrived at the adapter.

You could use a <header-enricher /> upstream of the adapter, to set header kafka_topic to the topic. That is the default mechanism used if no topic or topic-expression is configured on the adapter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM