<p>i'm building a POC that contains a Kafka cluster deployed on Kubernetes and three spring boot apps that read from kafka and write to jms and vice versa.</p>

<p>I want to know how data integrity and consistency is ensured for example:
If a producer node failed how the consumer is going to continue reading the message without losing the msg consistency.
Is there a detailed scenario to test this feature.</p>

aymen0406
<p>See <a href="https://docs.spring.io/spring-amqp/docs/2.2.5.RELEASE/reference/html/#transactions" rel="nofollow noreferrer">the Spring for Apache Kafka documentation</a> about transactions.</p>

<p>If you are new to Spring; also see <a href="https://docs.spring.io/spring/docs/5.2.5.RELEASE/spring-framework-reference/data-access.html#transaction" rel="nofollow noreferrer">Spring Framework's Transaction Support</a> which Spring Kafka leverages.</p>

<p>Kafka cannot paritipate in a JTA (XA) transactions so your only option is to consider <a href="https://www.javaworld.com/article/2077963/distributed-transactions-in-spring--with-and-without-xa.html" rel="nofollow noreferrer">Best Efforts 1PC commits</a> via Spring transaction synchronization and deal with the (small) possibility of redeliveries of messages that have previously been processed (after a failure).</p>
