Class KafkaConnectorCommonConfiguration
- java.lang.Object
-
- io.smallrye.reactive.messaging.kafka.KafkaConnectorCommonConfiguration
-
- Direct Known Subclasses:
KafkaConnectorIncomingConfiguration
,KafkaConnectorOutgoingConfiguration
public class KafkaConnectorCommonConfiguration extends Object
Extracts the common configuration for thesmallrye-kafka
connector.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.microprofile.config.Config
config
-
Constructor Summary
Constructors Constructor Description KafkaConnectorCommonConfiguration(org.eclipse.microprofile.config.Config config)
Creates a new KafkaConnectorCommonConfiguration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.microprofile.config.Config
config()
String
getBootstrapServers()
Gets the bootstrap.servers value from the configuration.String
getChannel()
protected <T> Optional<T>
getFromAlias(String alias, Class<T> type)
Retrieves the value stored for the given alias.protected <T> T
getFromAliasWithDefaultValue(String alias, Class<T> type, T defaultValue)
Retrieves the value stored for the given alias.Boolean
getHealthEnabled()
Gets the health-enabled value from the configuration.Boolean
getHealthReadinessEnabled()
Gets the health-readiness-enabled value from the configuration.Long
getHealthReadinessTimeout()
Gets the health-readiness-timeout value from the configuration.Optional<String>
getTopic()
Gets the topic value from the configuration.Boolean
getTracingEnabled()
Gets the tracing-enabled value from the configuration.void
validate()
-
-
-
Method Detail
-
config
public org.eclipse.microprofile.config.Config config()
- Returns:
- the connector configuration
-
getFromAlias
protected <T> Optional<T> getFromAlias(String alias, Class<T> type)
Retrieves the value stored for the given alias.- Type Parameters:
T
- the targeted type- Parameters:
alias
- the attribute alias, must not benull
or blanktype
- the targeted type- Returns:
- the configuration value for the given alias, empty if not set
-
getFromAliasWithDefaultValue
protected <T> T getFromAliasWithDefaultValue(String alias, Class<T> type, T defaultValue)
Retrieves the value stored for the given alias. Returns the default value if not present.- Type Parameters:
T
- the targeted type- Parameters:
alias
- the attribute alias, must not benull
or blanktype
- the targeted typedefaultValue
- the default value- Returns:
- the configuration value for the given alias, empty if not set
-
getChannel
public String getChannel()
- Returns:
- the channel name
-
getBootstrapServers
public String getBootstrapServers()
Gets the bootstrap.servers value from the configuration. Attribute Name: bootstrap.servers Description: A comma-separated list of host:port to use for establishing the initial connection to the Kafka cluster. MicroProfile Config Alias: kafka.bootstrap.servers Default Value: localhost:9092- Returns:
- the bootstrap.servers
-
getTopic
public Optional<String> getTopic()
Gets the topic value from the configuration. Attribute Name: topic Description: The consumed / populated Kafka topic. If neither this property nor the `topics` properties are set, the channel name is used- Returns:
- the topic
-
getHealthEnabled
public Boolean getHealthEnabled()
Gets the health-enabled value from the configuration. Attribute Name: health-enabled Description: Whether health reporting is enabled (default) or disabled Default Value: true- Returns:
- the health-enabled
-
getHealthReadinessEnabled
public Boolean getHealthReadinessEnabled()
Gets the health-readiness-enabled value from the configuration. Attribute Name: health-readiness-enabled Description: Whether readiness health reporting is enabled (default) or disabled Default Value: true- Returns:
- the health-readiness-enabled
-
getHealthReadinessTimeout
public Long getHealthReadinessTimeout()
Gets the health-readiness-timeout value from the configuration. Attribute Name: health-readiness-timeout Description: During the readiness health check, the connector connects to the broker and retrieves the list of topics. This attribute specifies the maximum duration (in ms) for the retrieval. If exceeded, the channel is considered not-ready. Default Value: 2000- Returns:
- the health-readiness-timeout
-
getTracingEnabled
public Boolean getTracingEnabled()
Gets the tracing-enabled value from the configuration. Attribute Name: tracing-enabled Description: Whether tracing is enabled (default) or disabled Default Value: true- Returns:
- the tracing-enabled
-
validate
public void validate()
-
-