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

Quarkus does not support map of properties #1

Open
dartartem opened this issue Jan 14, 2021 · 4 comments
Open

Quarkus does not support map of properties #1

dartartem opened this issue Jan 14, 2021 · 4 comments

Comments

@dartartem
Copy link
Contributor

Background

eventuate-messaging-kafka allows to define any kafka specific property to consumer/producer.

spring application.properties example:

eventuate.local.kafka.consumer.properties.session.timeout.ms=10000
eventuate.local.kafka.consumer.properties.key.serializer=org.apache.kafka.common.serialization.StringSerializer

properties resolved dynamically. Spring properties example:

@ConfigurationProperties("eventuate.local.kafka.consumer")
public class EventuateKafkaConsumerSpringConfigurationProperties {
  Map<String, String> properties = new HashMap<>();

  public Map<String, String> getProperties() {
    return properties;
  }
}

Why it is important

in case if kafka version is updated and provided new configuration properties, it will be not necessary to update eventuate-messaging-kafka

Problem

According the following issues, quarkus does not support similar behavior:

quarkusio/quarkus#8017
eclipse/microprofile-config#545

Only one way I found to support it, it is write quarkus extension:

https://stackoverflow.com/a/61673372/14879093

I see the following drawbacks:

  • too complicated for so simple feature
  • I did not find gradle example, looks like it supports only maven. So it requires to create separate maven project with extension.
  • extension is necessary to create for each configuration group e.g. for consumer and producer modules, so it requires 2 separate maven projects.

Proposed solution

Currently I implemented json configuration for kafka properties:

eventuate.local.kafka.consumer.additional-properties={"key.serializer" : "org.apache.kafka.common.serialization.StringSerializer", "session.timeout.ms" : "10000"}

It is simple and not much more inconvenient than property per config.

@cer
Copy link
Contributor

cer commented Jan 14, 2021

You solution seems reasonable.
However, I'd support the existing map for Spring/Micronaut since that works well there.

@dartartem
Copy link
Contributor Author

Chris,

If you mean that I should use json configuration only for quarkus modules and use existing approach for spring/micronaut,
then I did exactly it. If you mean something else, could you please clarify?

@cer
Copy link
Contributor

cer commented Jan 14, 2021

use json configuration only for quarkus modules and use existing approach for spring/micronaut,

Yes

@dartartem
Copy link
Contributor Author

Got it. Thank you.

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

No branches or pull requests

2 participants