K - the key type.V - the value type.public class DefaultKafkaConsumerFactory<K,V> extends java.lang.Object implements ConsumerFactory<K,V>
ConsumerFactory implementation to produce a new Consumer instance
for provided Map configs and optional Deserializer keyDeserializer,
valueDeserializer implementations on each createConsumer()
invocation.| Constructor and Description |
|---|
DefaultKafkaConsumerFactory(java.util.Map<java.lang.String,java.lang.Object> configs) |
DefaultKafkaConsumerFactory(java.util.Map<java.lang.String,java.lang.Object> configs,
org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer,
org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.kafka.clients.consumer.Consumer<K,V> |
createConsumer()
Create a consumer with the group id and client id as configured in the properties.
|
org.apache.kafka.clients.consumer.Consumer<K,V> |
createConsumer(java.lang.String clientIdSuffix)
Create a consumer, appending the suffix to the
client.id property,
if present. |
org.apache.kafka.clients.consumer.Consumer<K,V> |
createConsumer(java.lang.String groupId,
java.lang.String clientIdSuffix)
Create a consumer with an explicit group id; in addition, the
client id suffix is appended to the
client.id property, if both
are present. |
protected org.apache.kafka.clients.consumer.KafkaConsumer<K,V> |
createKafkaConsumer() |
protected org.apache.kafka.clients.consumer.KafkaConsumer<K,V> |
createKafkaConsumer(java.util.Map<java.lang.String,java.lang.Object> configs) |
protected org.apache.kafka.clients.consumer.KafkaConsumer<K,V> |
createKafkaConsumer(java.lang.String groupId,
java.lang.String clientIdSuffix) |
java.util.Map<java.lang.String,java.lang.Object> |
getConfigurationProperties()
Return an unmodifiable reference to the configuration map for this factory.
|
org.apache.kafka.common.serialization.Deserializer<K> |
getKeyDeserializer() |
org.apache.kafka.common.serialization.Deserializer<V> |
getValueDeserializer() |
boolean |
isAutoCommit()
Return true if consumers created by this factory use auto commit.
|
void |
setKeyDeserializer(org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer) |
void |
setValueDeserializer(org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer) |
public DefaultKafkaConsumerFactory(java.util.Map<java.lang.String,java.lang.Object> configs)
public void setKeyDeserializer(org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer)
public void setValueDeserializer(org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)
public java.util.Map<java.lang.String,java.lang.Object> getConfigurationProperties()
ConsumerFactorygetConfigurationProperties in interface ConsumerFactory<K,V>public org.apache.kafka.common.serialization.Deserializer<K> getKeyDeserializer()
public org.apache.kafka.common.serialization.Deserializer<V> getValueDeserializer()
public org.apache.kafka.clients.consumer.Consumer<K,V> createConsumer()
ConsumerFactorycreateConsumer in interface ConsumerFactory<K,V>public org.apache.kafka.clients.consumer.Consumer<K,V> createConsumer(java.lang.String clientIdSuffix)
ConsumerFactoryclient.id property,
if present.createConsumer in interface ConsumerFactory<K,V>clientIdSuffix - the suffix.public org.apache.kafka.clients.consumer.Consumer<K,V> createConsumer(java.lang.String groupId, java.lang.String clientIdSuffix)
ConsumerFactoryclient.id property, if both
are present.createConsumer in interface ConsumerFactory<K,V>groupId - the group id.clientIdSuffix - the suffix.protected org.apache.kafka.clients.consumer.KafkaConsumer<K,V> createKafkaConsumer()
protected org.apache.kafka.clients.consumer.KafkaConsumer<K,V> createKafkaConsumer(java.lang.String groupId, java.lang.String clientIdSuffix)
protected org.apache.kafka.clients.consumer.KafkaConsumer<K,V> createKafkaConsumer(java.util.Map<java.lang.String,java.lang.Object> configs)
public boolean isAutoCommit()
ConsumerFactoryisAutoCommit in interface ConsumerFactory<K,V>