Skip to content

Add max age configuration for Kafka transactions - #3312

Open
yashdotdev13 wants to merge 2 commits into
spring-cloud:mainfrom
yashdotdev13:fix/2856-kafka-transaction-max-age
Open

yashdotdev13 wants to merge 2 commits into
spring-cloud:mainfrom
yashdotdev13:fix/2856-kafka-transaction-max-age

Conversation

@yashdotdev13

Copy link
Copy Markdown
Contributor

Summary

Closes #2856.

Adds support for configuring the maximum age of transactional Kafka producers through the Kafka binder's transaction properties.

  • Introduces the spring.cloud.stream.kafka.binder.transaction.max-age configuration property.
  • Applies the configured maximum age to the transactional DefaultKafkaProducerFactory.
  • Adds unit and integration tests to verify property configuration and application.

Configuration Example

spring:
  cloud:
    stream:
      kafka:
        binder:
          transaction:
            transaction-id-prefix: tx-
            max-age: 5m

Testing

  • KafkaBinderConfigurationPropertiesTest — passed.
  • KafkaBinderConfigurationWithTransactionsTest — passed.
  • Full Kafka binder test suite — 169 tests run, 0 failures, 10 skipped.
  • git diff --check — passed.

Signed-off-by: 98001yash <yashchauhan.gaya@gmail.com>
@olegz

olegz commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

If you look at the PR it shows two deprecations. Can you please address them?

Signed-off-by: 98001yash <yashchauhan.gaya@gmail.com>
@yashdotdev13

yashdotdev13 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for pointing this out! I have replaced the deprecated KafkaProperties.buildConsumerProperties() and KafkaProperties.buildProducerProperties() calls with KafkaConfigBuilder, following the implementation of the deprecated methods.

I've also verified the changes by running KafkaBinderConfigurationPropertiesTest — all 14 tests passed.

This branch has not been deployed

No deployments
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.

Feature Request: Add maxAge to the binder properties

2 participants