Skip to content

Conversation

garyrussell
Copy link
Contributor

Resolves #2001

Previously, synchronized transaction commits (for producer initiated
transactions) were not propagated to the caller.

cherry-pick to all supported branches

Resolves spring-projects#2001

Previously, synchronized transaction commits (for producer initiated
transactions) were not propagated to the caller.

**cherry-pick to all supported branches**
@artembilan artembilan merged commit 505bd84 into spring-projects:main Nov 9, 2021
@artembilan
Copy link
Member

... and cherry-picked to 2.7.x.

Back-ported to 2.6.x & 2.5.x as fa47642 after fixing conflicts in docs.

garyrussell added a commit to garyrussell/spring-kafka that referenced this pull request Mar 2, 2023
Resolves spring-projects#2604

Prior to spring-projects#2005 synchronized transactions were committed in `afterCompletion`.
This was incorrect because a failure to commit was not propagated to the caller.
However, if a higher order synchronization throws an exception in `afterCommit`,
the producer is closed (returned to the cache) while still in a transaction -
the transaction was not committed.

Restore the commit in `afterCompletion` and add a check in `KafkaResourceHolder`
to only commit once.

Add tests.

**cherry-pick to 2.9.x**
artembilan pushed a commit that referenced this pull request Mar 2, 2023
Resolves #2604

Prior to #2005 synchronized transactions were committed in `afterCompletion`.
This was incorrect because a failure to commit was not propagated to the caller.
However, if a higher order synchronization throws an exception in `afterCommit`,
the producer is closed (returned to the cache) while still in a transaction -
the transaction was not committed.

Restore the commit in `afterCompletion` and add a check in `KafkaResourceHolder`
to only commit once.

Add tests.

**cherry-pick to 2.9.x**
artembilan pushed a commit that referenced this pull request Mar 2, 2023
Resolves #2604

Prior to #2005 synchronized transactions were committed in `afterCompletion`.
This was incorrect because a failure to commit was not propagated to the caller.
However, if a higher order synchronization throws an exception in `afterCommit`,
the producer is closed (returned to the cache) while still in a transaction -
the transaction was not committed.

Restore the commit in `afterCompletion` and add a check in `KafkaResourceHolder`
to only commit once.

Add tests.

**cherry-pick to 2.9.x**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JPA+Kafka: Exception during commit does not rollback and client is unaware of error
2 participants