Skip to content

SubscribeStrategy

SubscribeStrategy is a ConsumerStrategy that is used for subscribe option.

SubscribeStrategy uses KafkaConsumer.subscribe to subscribe a KafkaConsumer to the given topics.

Creating Instance

SubscribeStrategy takes the following to be created:

  • Topic Names

SubscribeStrategy is created when:

Creating Kafka Consumer

createConsumer(
  kafkaParams: ju.Map[String, Object]): Consumer[Array[Byte], Array[Byte]]

createConsumer is part of the ConsumerStrategy abstraction.


createConsumer creates a KafkaConsumer (Apache Kafka) to subscribe (using KafkaConsumer.subscribe) to the given topics.

Assigned TopicPartitions

assignedTopicPartitions(
  admin: Admin): Set[TopicPartition]

assignedTopicPartitions is part of the ConsumerStrategy abstraction.


assignedTopicPartitions retrieveAllPartitions.

String Representation

toString(): String

toString is part of the Object (Java) abstraction.


toString is the following (with the comma-separated topic names):

Subscribe[[topics]]

toString is used (among the other uses) when: