Skip to content

Feature Request: Add maxAge to the binder properties #2856

Open
@Fonexn

Description

@Fonexn

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

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