Skip to content

Problems with applying clientFactoryCustomizer when using a transaction producer #3090

@youngpark17

Description

@youngpark17

Describe the issue

The clientFactoryCustomizer does not register properly when it is a transaction producer.

To Reproduce

@Bean
ClientFactoryCustomizer clientFactoryCustomizer() {
	return new ClientFactoryCustomizer() {
		@Override
		public void configure(ProducerFactory<?, ?> producerFactory) {
			if (producerFactory instanceof DefaultKafkaProducerFactory) {
				((DefaultKafkaProducerFactory) producerFactory).setMaxAge(Duration.ofDays(6));
			}
		}
	};
}
spring:
  cloud:
    stream:
      kafka:
        binder:
          brokers: host
          required-acks: all
          auto-create-topics: false
          auto-add-partitions: false
          transaction:
            transaction-id-prefix: ${random.uuid}
          producer-properties:
            acks: all
            retries: 3
            enable.idempotence: true
            max.in.flight.requests.per.connection: 1
            max.block.ms: 5000
        bindings:
          outbound-test-command:
            producer:
              allowNonTransactional: false
  1. make ProducerFactory in transaction producer
    Image

  2. clientFactoryCustomizers trying to customize but clientFactoryCustomizers is empty
    Image

  3. add clientFactoryCustomizers after customizer
    Image

clientFactoryCustomizer needs to set maxAge but cannot.

Version of the framework
:: Spring Boot :: (v3.4.1)
spring-cloud-stream 4.2
spring-cloud-stream-binder-kafka 4.2

Expected behavior
clientFactoryCustomizer needs to set maxAge
Screenshots

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions