Retrieving Kafka default configuration
If your application/runtime exposes as a CDI bean of type
Map<String, Object
with the identifier default-kafka-broker
, this
configuration is used to establish the connection with the Kafka broker.
For example, you can imagine exposing this map as follows:
This previous example would extract all the configuration keys from
MicroProfile Config starting with kafka
.
Quarkus
Starting with Quarkus 1.5, a map corresponding to the previous example is automatically provided.
In addition to this default configuration, you can configure the name of
the Map
producer using the kafka-configuration
attribute:
In this case, the connector looks for the Map
associated with the
my-configuration
name. If kafka-configuration
is not set, an
optional lookup for a Map
exposed with the channel name (my-channel
in the previous example) is done.
Important
If kafka-configuration
is set and no Map
can be found, the
deployment fails.
Attribute values are resolved as follows:
-
if the attribute is set directly on the channel configuration (
mp.messaging.incoming.my-channel.attribute=value
), this value is used -
if the attribute is not set on the channel, the connector looks for a
Map
with the channel name or the configuredkafka-configuration
(if set) and the value is retrieved from thatMap
-
If the resolved
Map
does not contain the value the defaultMap
is used (exposed with thedefault-kafka-broker
name)