Skip to content

Commit

Permalink
Retrieve kafka configuration with raw string convention. Fixes micron…
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskleeh authored May 15, 2020
1 parent 319c7b1 commit 7a688f5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.micronaut.context.annotation.Requires;
import io.micronaut.context.env.Environment;
import io.micronaut.core.convert.ConversionService;
import io.micronaut.core.naming.conventions.StringConvention;
import org.apache.kafka.clients.consumer.ConsumerConfig;

import java.time.Duration;
Expand Down Expand Up @@ -80,7 +81,7 @@ public void setHealthTimeout(Duration healthTimeout) {
}

private static Properties resolveDefaultConfiguration(Environment environment) {
Map<String, Object> values = environment.containsProperties(PREFIX) ? environment.getProperties(PREFIX) : Collections.emptyMap();
Map<String, Object> values = environment.containsProperties(PREFIX) ? environment.getProperties(PREFIX, StringConvention.RAW) : Collections.emptyMap();
Properties properties = new Properties();
values.entrySet().stream().filter(entry -> {
String key = entry.getKey();
Expand Down

3 comments on commit 7a688f5

@brandon-johnson-globality

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change causes config via environment variables to be ignored. For example, set the bootstrap servers via application.yml and then attempt to override those via environment variable.

environment.getProperties(PREFIX) correctly returns the value set via the KAFKA_BOOTSTRAP_SERVERS environment variable.
environment.getProperties(PREFIX, StringConvention.RAW) returns the value of kafka.bootstrap.servers from application.yml.

@graemerocher
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandon-johnson-globality can you report an issue?

@brandon-johnson-globality

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.