Class ConsumerDelegateCreator
java.lang.Object
org.apache.kafka.clients.consumer.internals.ConsumerDelegateCreator
ConsumerDelegateCreator implements a quasi-factory pattern to allow the caller to remain unaware of the
underlying Consumer implementation that is created. This provides the means by which KafkaConsumer
can remain the top-level facade for implementations, but allow different implementations to co-exist under
the covers.
The current logic for the ConsumerCreator inspects the incoming configuration and determines if
it is using the new consumer group protocol (KIP-848) or if it should fall back to the existing, legacy group
protocol. This is based on the presence and value of the group.protocol
configuration. If the value is present and equal to "consumer", the AsyncKafkaConsumer
will be returned. Otherwise, the LegacyKafkaConsumer will be returned.
Note: this is for internal use only and is not intended for use by end users. Internal users should
not attempt to determine the underlying implementation to avoid coding to an unstable interface. Rather, it is
the Consumer API contract that should serve as the caller's interface.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<K,V> ConsumerDelegate <K, V> create(ConsumerConfig config, Deserializer<K> keyDeserializer, Deserializer<V> valueDeserializer) <K,V> ConsumerDelegate <K, V> create(org.apache.kafka.common.utils.LogContext logContext, org.apache.kafka.common.utils.Time time, ConsumerConfig config, Deserializer<K> keyDeserializer, Deserializer<V> valueDeserializer, org.apache.kafka.clients.KafkaClient client, SubscriptionState subscriptions, ConsumerMetadata metadata, List<ConsumerPartitionAssignor> assignors)
-
Constructor Details
-
ConsumerDelegateCreator
public ConsumerDelegateCreator()
-
-
Method Details
-
create
public <K,V> ConsumerDelegate<K,V> create(ConsumerConfig config, Deserializer<K> keyDeserializer, Deserializer<V> valueDeserializer) -
create
public <K,V> ConsumerDelegate<K,V> create(org.apache.kafka.common.utils.LogContext logContext, org.apache.kafka.common.utils.Time time, ConsumerConfig config, Deserializer<K> keyDeserializer, Deserializer<V> valueDeserializer, org.apache.kafka.clients.KafkaClient client, SubscriptionState subscriptions, ConsumerMetadata metadata, List<ConsumerPartitionAssignor> assignors)
-