[英]How do i get the messages from the offset in Spring Cloud Stream Kafka Binder?
[英]How to get failedMessage from the payload in the ErrorMessage in spring cloud stream kafka?
我需要使用错误消息,并根据失败原因重试或丢弃该消息。 为了测试这一点,我从代码中明确抛出了运行时异常,我看到ErrorMessage中的originalMessage和标头为空。 但是我将有效负载视为字节数组,并将有效负载的failMessage中的自定义标头视为字节。如何获取此内容? 我在ErrorMessage的有效负载中没有看到为failedMessage属性指定的吸气剂。
failedMessage
是有效载荷的属性,该属性是MessagingException
。 演员吧...
Message<?> failed = ((MessagingException) em.getPayload()).getFailedMessage();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.