Class BasicConsumerConfigBuilder
- java.lang.Object
-
- com.adaptris.kafka.ConfigBuilderImpl
-
- com.adaptris.kafka.BasicConsumerConfigBuilder
-
- All Implemented Interfaces:
ConfigBuilder
,ConsumerConfigBuilder
@ComponentProfile(summary="Basic implementation of a Kafka consumer config builder", tag="builder,kafka", since="3.6.6") public class BasicConsumerConfigBuilder extends ConfigBuilderImpl implements ConsumerConfigBuilder
Basic implementation ofConsumerConfigBuilder
.Only "high" importance properties from the Apache Kafka Consumer Config Documentation are exposed; all other properties are left as default. The
key.serializer
property is fixed to be aStringSerializer
; and thevalue.serializer
property is always anAdaptrisMessageSerializer
.In the adapter configuration file this class is aliased as kafka-basic-consumer-config which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.adaptris.kafka.ConfigBuilder
ConfigBuilder.Acks, ConfigBuilder.CompressionType, ConfigBuilder.KeyFilter
-
-
Field Summary
-
Fields inherited from class com.adaptris.kafka.ConfigBuilderImpl
log
-
Fields inherited from interface com.adaptris.kafka.ConfigBuilder
DEFAULT_KEY_DESERIALIZER, DEFAULT_KEY_SERIALIZER, DEFAULT_VALUE_DESERIALIZER, DEFAULT_VALUE_SERIALIZER, KEY_DESERIALIZER_FACTORY_CONFIG
-
-
Constructor Summary
Constructors Constructor Description BasicConsumerConfigBuilder()
BasicConsumerConfigBuilder(java.lang.String bootstrapServers)
BasicConsumerConfigBuilder(java.lang.String bootstrapServers, java.lang.String groupId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>
build(ConfigBuilder.KeyFilter filter)
Build a configuration with a filter applied to the config names.@NonNull java.lang.String
getBootstrapServers()
Set thebootstrap.servers
property.java.lang.String
getGroupId()
Set thegroup.id
property.void
setBootstrapServers(@NonNull java.lang.String bootstrapServers)
Set thebootstrap.servers
property.void
setGroupId(java.lang.String groupId)
Set thegroup.id
property.-
Methods inherited from class com.adaptris.kafka.ConfigBuilderImpl
addEntry
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.kafka.ConsumerConfigBuilder
build
-
-
-
-
Constructor Detail
-
BasicConsumerConfigBuilder
public BasicConsumerConfigBuilder()
-
BasicConsumerConfigBuilder
public BasicConsumerConfigBuilder(java.lang.String bootstrapServers)
-
BasicConsumerConfigBuilder
public BasicConsumerConfigBuilder(java.lang.String bootstrapServers, java.lang.String groupId)
-
-
Method Detail
-
build
public java.util.Map<java.lang.String,java.lang.Object> build(ConfigBuilder.KeyFilter filter) throws CoreException
Description copied from interface:ConfigBuilder
Build a configuration with a filter applied to the config names.- Specified by:
build
in interfaceConfigBuilder
- Parameters:
filter
- the keys to keep.- Returns:
- the configuration
- Throws:
CoreException
- wrapping any underlying exception.- See Also:
ConfigDefinition
-
getBootstrapServers
@NonNull public @NonNull java.lang.String getBootstrapServers()
Set thebootstrap.servers
property.A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. The client will make use of all servers irrespective of which servers are specified here for bootstrapping; this list only impacts the initial hosts used to discover the full set of servers. This list should be in the form
host1:port1,host2:port2,....
. Since these servers are just used for the initial connection to discover the full cluster membership (which may change dynamically), this list need not contain the full set of servers (you may want more than one, though, in case a server is down).
-
setBootstrapServers
public void setBootstrapServers(@NonNull @NonNull java.lang.String bootstrapServers)
Set thebootstrap.servers
property.A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. The client will make use of all servers irrespective of which servers are specified here for bootstrapping; this list only impacts the initial hosts used to discover the full set of servers. This list should be in the form
host1:port1,host2:port2,....
. Since these servers are just used for the initial connection to discover the full cluster membership (which may change dynamically), this list need not contain the full set of servers (you may want more than one, though, in case a server is down).- Parameters:
bootstrapServers
- the bootstrap servers
-
getGroupId
public java.lang.String getGroupId()
Set thegroup.id
property.A unique string that identifies the consumer group this consumer belongs to. This property is required if the consumer uses either the group management functionality by using subscribe(topic) or the Kafka-based offset management strategy.
-
setGroupId
public void setGroupId(java.lang.String groupId)
Set thegroup.id
property.A unique string that identifies the consumer group this consumer belongs to. This property is required if the consumer uses either the group management functionality by using subscribe(topic) or the Kafka-based offset management strategy.
- Parameters:
groupId
- the groupId to set
-
-