spring-cloud / spring-cloud/spring-cloud-stream

Feature request: enable recreation of kafka producer during runtime with spring-cloud-stream

Open
#2,827 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-on-feedback
Dominant language
Java
Stars
1.1k
Forks
646
Avg merge
2d 3h
Merged PRs (30d)
8

Description

Feature:
Recreation of kafka producer during runtime

Description:
It should be possible to allow recreation of kafka producers during runtime (means: spring boot aplication must not be restared). This can be useful, e.g. if connection security properties change, like a new client certificate being provided, etc.

Current mode:
Currently, e.g. SSLContext can be modified by specifying a custom SslEngineFactory. However, this applies only during creation time of a kafka producer and cannot be updated during lifetime.

Future mode:
Producer lifecycle could be modified by using setMaxAge() or reset() of DefaultKafkaProducerFactory. However, when using spring-cloud-stream, one can neither get a hold of DefaultKafkaProducerFactory, nor replace it with a custom implementation, because its explicitly referenced.
Of course, various other possibilities exist to implement.

Versions:
Observed with Spring Boot 3.0.11 and Spring 2022.0.4.

Reference:
See https://stackoverflow.com/questions/77257927/refreshing-kafka-producer-during-runtime-in-spring-application/77259917#77259917

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading how Spring Cloud Stream explicitly references DefaultKafkaProducerFactory and review the lifecycle options named in the issue: setMaxAge() and reset(). Compare that integration with SslEngineFactory creation-time behavior; done means a running Spring Boot application can recreate its Kafka producer after security properties change without restarting.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kafka, spring
Domain
backend, stream-processing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.