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

KafkaStreamsExecutionContext could expose all properties instead of only the ones under kafka.properties #198

Open
SouquieresAdam opened this issue Apr 22, 2024 · 1 comment
Labels
enhancement This issue or pull request improves a feature feature This issue adds a new feature good first issue Good for newcomers

Comments

@SouquieresAdam
Copy link
Collaborator

SouquieresAdam commented Apr 22, 2024

Problem

KStreamplify reads all configurations from the Spring Boot context and exposes those under the kafka.properties prefix in a static global object, KafkaStreamsExecutionContext.

protected void initProperties() { properties = PropertiesUtils.loadProperties(); serverPort = (Integer) properties.get(SERVER_PORT_PROPERTY); kafkaProperties = PropertiesUtils.loadKafkaProperties(properties); KafkaStreamsExecutionContext.registerProperties(kafkaProperties); }

Suggestion

I would like to be able to access all my properties through this object to manage some business or technical aspects that are not directly related to Kafka from my external configuration. Typically, a Kafka Streams application developed with KStreamplify uses Processor or Transformer classes, which are not directly managed by the Spring Application Context.

Alternatives Considered

Possible alternatives for implementation include:

  • Hard-coding the kafka.properties prefix that determines what is exposed in the KafkaStreamsExecutionContext.
  • Keeping kafka.properties isolated but exposing all properties visible in the Spring Boot configuration context.
  • Creating a new application.properties static property category that contains both business and technical parameters we want to expose in the KafkaStreamsExecutionContext static class.
  • Using a separate class like ApplicationConfigurationContext, which contains only the non-Kafka business and technical parameters of the Kafka Streams application.
@SouquieresAdam SouquieresAdam added enhancement This issue or pull request improves a feature good first issue Good for newcomers feature This issue adds a new feature labels Apr 22, 2024
@loicgreffier
Copy link
Collaborator

@SouquieresAdam,

Good issue,

I have considered something like:

  • Renaming the current properties to kafkaProperties
  • In the KafkaStreamsExecutionContext, add a new attribute applicationProperties containing all other properties that are not related to Kafka

But this would break the previous version as users would have to move from getProperties() to getKafkaProperties() and would have to look for properties either on kafkaProperties or applicationProperties.

kafka.properties needs to be kept isolated to:

I think the option 2 would just offer the simplest approach:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue or pull request improves a feature feature This issue adds a new feature good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants