Skip to content

Is Non Blocking Retry (@Retryable) intended to be combined with Kafka Transactions (consumer initiated) ? #2934

@PaulFert

Description

@PaulFert

Discussed in #2918

Originally posted by PaulFert December 1, 2023
Hello,

I wanted to use both features for consume -> process -> produce applications

When i use Transaction with Blocking Retry, DLT Recover the flow is :
Kafka-Error-Handling-Transaction-Blocking-Retry-Transaction drawio

When exception is raised from the listener, the transaction is rollback and then a new transaction is created for the send to DLT, OK fine.

On the oher side, when i use Transaction with Non Blocking Retry the flow is more like that :
Kafka-Error-Handling-Transaction-Non-Blocking-Retry-Transaction drawio

When exception is raised from the listener, the transaction is not rollback, the message is send to retry topic and finally the transaction is comited. Then consumer offsets is commit plus the messages out and messages to retry topic. If an exception is raised i want my messages out to be not comited.

It's not what i expected, i expected a flow like that :
Kafka-Error-Handling-Transaction-Non-Blocking-Retry-Transaction-expected drawio

Did i miss something with the configuration ? I use standard configuration, with one kafkatemplate, with transactional producer
Or maybe did i misunderstood the Non Blocking Retry pattern, Transactions are not intended to be combined with ?

Sorry for my poor english...

Testing with 'org.springframework.boot' version '3.1.1-SNAPSHOT', spring-kafka version 3.0.8

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions