Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add maxAge to the binder properties #2856

Open
Fonexn opened this issue Nov 21, 2023 · 0 comments
Open

Feature Request: Add maxAge to the binder properties #2856

Fonexn opened this issue Nov 21, 2023 · 0 comments

Comments

@Fonexn
Copy link

Fonexn commented Nov 21, 2023

Hello,

Coming from here: https://stackoverflow.com/questions/77510784/how-work-maxage-in-spring-kafka-factory-producer/77517766#77517766

Now you need to manually set maxAge for each binder programmatically, example:

    @Bean
    KafkaTransactionManager customKafkaTransactionManager() {
        KafkaMessageChannelBinder kafka = (KafkaMessageChannelBinder)this.binderFactory.getBinder("kafka1", MessageChannel.class);
        DefaultKafkaProducerFactory<byte[], byte[]> producerFactory = (DefaultKafkaProducerFactory<byte[], byte[]>) kafka.getTransactionalProducerFactory();

        producerFactory.setMaxAge(Duration.ofSeconds(60));

        return new KafkaTransactionManager(producerFactory);
    }

It would be good to add the possibility of configuring this property in each binder from the application properties in yaml. For example spring.cloud.stream.kafka.binder.transaction.maxAge in ms

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants