Skip to content

Commit

Permalink
Improve Kafka environment variable config documentation
Browse files Browse the repository at this point in the history
Added documentation about dynamic config keys and the need to disambiguate them in the config file or as system properties. Also explained the need to use double underscore for properties that include a period in their key.
  • Loading branch information
StFS authored Aug 9, 2023
1 parent af1ed37 commit 9c39c65
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,28 @@ The Kafka clients require at least the `bootstrap.servers` property to be set. T
required to enable Kafka based messaging.
{{% /notice %}}

{{% notice tip %}}
The Kafka client configuration is composed of a number of properties that have an ambiguous mapping to environment
variable names. For example, the property key `"bootstrap.servers"` in the `hono.kafka.commonClientConfig` map would
have the same mapping to an environment variable as `"bootstrap-servers"` and `"bootstrap_servers"` (they would all map
to `__BOOTSTRAP_SERVERS__`).

To resolve this ambiguity and allow ambiguous properties to be overridden using environment variables, the configuration
framework relies on the correct property being defined in a configuration source which uses unambiguous property key
representations and has a lower precedence than the environment variable configuration source. It's therefore necessary
to provide any such configuration property in the `application.yml` file or as a Java system property to help the
configuration system disambiguate the property key, even if only providing a placeholder value.
{{% /notice %}}

{{% notice tip %}}
Some of the Kafka configuration options beneath `hono.kafka.commonClientConfig` need to be quoted as the keys themselves
can contain hierarchical delimiters such as a period (`.`). An example of that is `bootstrap.servers` which is a single
key within the `hono.kafka.commonClientConfig` configuration map.
To represent such a key with an environment variable, you must use double underscores for representing the quoted key.
For example, the environment variable to represent `hono.kafka.commonClientConfig."bootstrap.servers"` is
`HONO_KAFKA_COMMONCLIENTCONFIG__BOOTSTRAP_SERVERS__`.
{{% /notice %}}

## Using TLS

The factory can be configured to use TLS for authenticating the brokers in the Kafka cluster during connection
Expand Down

0 comments on commit 9c39c65

Please sign in to comment.