Class ConfigHelper
- java.lang.Object
-
- io.smallrye.reactive.messaging.kafka.impl.ConfigHelper
-
public class ConfigHelper extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_KAFKA_BROKERstatic StringKAFKA_CONFIGURATION_NAME_ATTRIBUTE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,Object>getChannelSpecificConfig(javax.enterprise.inject.Instance<Map<String,Object>> instances, org.eclipse.microprofile.config.Config config)Looks for aMap%lt;String, Object>for the given channel.static Map<String,Object>lookupForIdentifiedConfiguration(javax.enterprise.inject.Instance<Map<String,Object>> instances, String identifier, boolean optional)Looks for a CDI bean of typeMapidentified using the given named.static org.eclipse.microprofile.config.Configmerge(org.eclipse.microprofile.config.Config passedCfg, Map<String,Object> defaultKafkaCfg)static org.eclipse.microprofile.config.Configmerge(org.eclipse.microprofile.config.Config passedCfg, Map<String,Object> namedConfig, Map<String,Object> defaultKafkaCfg)Returns aConfiginstance merging the values from the 3 sources (the channel configuration, a map specific to the channel and the global Kafka configuration).static org.eclipse.microprofile.config.ConfigretrieveChannelConfiguration(javax.enterprise.inject.Instance<Map<String,Object>> instances, org.eclipse.microprofile.config.Config config)Computes the channel configuration The channel configuration is extracted from 3 places (from the most important to the less important): The channel configuration in the application configuration (the mp.messaging.[incoming|outgoing].channel.attr=value From a bean exposing a Map%lt;String, Object> exposed with @Identifier(channel).static Map<String,Object>retrieveDefaultKafkaConfig(javax.enterprise.inject.Instance<Map<String,Object>> instances)Retrieves the default Kafka configuration if any.
-
-
-
Field Detail
-
KAFKA_CONFIGURATION_NAME_ATTRIBUTE
public static final String KAFKA_CONFIGURATION_NAME_ATTRIBUTE
- See Also:
- Constant Field Values
-
DEFAULT_KAFKA_BROKER
public static final String DEFAULT_KAFKA_BROKER
- See Also:
- Constant Field Values
-
-
Method Detail
-
retrieveChannelConfiguration
public static org.eclipse.microprofile.config.Config retrieveChannelConfiguration(javax.enterprise.inject.Instance<Map<String,Object>> instances, org.eclipse.microprofile.config.Config config)
Computes the channel configuration The channel configuration is extracted from 3 places (from the most important to the less important):- The channel configuration in the application configuration (the mp.messaging.[incoming|outgoing].channel.attr=value
- From a bean exposing a Map%lt;String, Object> exposed with @Identifier(channel). The content of this map is generated by the runtime. The name can be configured using the mp.messaging.[incoming|outgoing].channel.kafka-configuration attribute
- The default Kafka configuration (generally the kafka.attr=value properties), also exposed as an identified Map%lt;String, Object>.
- Parameters:
config- the received config- Returns:
- the computed configuration
-
merge
public static org.eclipse.microprofile.config.Config merge(org.eclipse.microprofile.config.Config passedCfg, Map<String,Object> defaultKafkaCfg)
-
merge
public static org.eclipse.microprofile.config.Config merge(org.eclipse.microprofile.config.Config passedCfg, Map<String,Object> namedConfig, Map<String,Object> defaultKafkaCfg)Returns aConfiginstance merging the values from the 3 sources (the channel configuration, a map specific to the channel and the global Kafka configuration).- Parameters:
passedCfg- the channel configuration (high priority)namedConfig- the channel specific configuration (medium priority)defaultKafkaCfg- the default Kafka configuration (low priority)- Returns:
- the computed config.
-
retrieveDefaultKafkaConfig
public static Map<String,Object> retrieveDefaultKafkaConfig(javax.enterprise.inject.Instance<Map<String,Object>> instances)
Retrieves the default Kafka configuration if any. It looks for aMap%lt;String, Object>identified byDEFAULT_KAFKA_BROKER.- Parameters:
instances- the instances of map exposed as bean- Returns:
- the map, empty if the lookup fails
-
getChannelSpecificConfig
public static Map<String,Object> getChannelSpecificConfig(javax.enterprise.inject.Instance<Map<String,Object>> instances, org.eclipse.microprofile.config.Config config)
Looks for aMap%lt;String, Object>for the given channel. The map is identified usingIdentifier. The identifier value is either configured in the channel configuration, or is the channel name.- Parameters:
instances- the instances of map exposed as beanconfig- the channel configuration- Returns:
- the map, empty if the lookup fails.
-
lookupForIdentifiedConfiguration
public static Map<String,Object> lookupForIdentifiedConfiguration(javax.enterprise.inject.Instance<Map<String,Object>> instances, String identifier, boolean optional)
Looks for a CDI bean of typeMapidentified using the given named. If the lookup fails andoptionalistrue, anUnsatisfiedResolutionExceptionis thrown. Otherwise, an emptyMapis returned.- Parameters:
identifier- the identifieroptional- whether the lookup is optional- Returns:
- the result
-
-