java - Spring Cloud Stream send to Kafka error control handling -
how catch error writing kafka topic?
import org.springframework.cloud.stream.annotation.enablebinding; import org.springframework.cloud.stream.annotation.streamlistener; import org.springframework.cloud.stream.messaging.processor; import org.springframework.messaging.message; import org.springframework.messaging.handler.annotation.sendto; import org.springframework.stereotype.component; import javax.xml.bind.jaxbexception; @component @enablebinding(processor.class) public class parser { @streamlistener(processor.input) @sendto(processor.output) public string process(message<?> input) { // smth // how catch error if sending message 'output' topic fails } } switch producer synchronous mode.
spring.cloud.stream.kafka.bindings.output.producer.sync=true what next? examples? extend binding impl, add aop magic?
i think need register kafkaproducerlistener handles error scenario in case , make available bean in application.
for more info on kafkaproducerlistener here
also, note failed messages available on errorchannel channel name error. error messages published once have configure destination name error channel: spring.cloud.stream.bindings.error.destination.
Comments
Post a Comment