io.vertx.kafka.client.consumer

## Interface KafkaReadStream<K,V>

- All Superinterfaces:
    ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>, StreamBase

      public interface KafkaReadStream<K,V>
      extends ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>

  A `ReadStream` for consuming Kafka `ConsumerRecord`.

  The `pause()` and `resume()` provides global control over reading the records from the consumer.

  The `pause(Set)` and `resume(Set)` provides finer grained control over reading records for specific Topic/Partition, these are Kafka's specific operations.

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `KafkaReadStream<K,V>` | `assign(Set<org.apache.kafka.common.TopicPartition> partitions)` Manually assign a set of partitions to this consumer.
    `KafkaReadStream<K,V>` | `assign(Set<org.apache.kafka.common.TopicPartition> partitions, Handler<AsyncResult<Void>> completionHandler)` Manually assign a set of partitions to this consumer.
    `KafkaReadStream<K,V>` | `assignment(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)` Get the set of partitions currently assigned to this consumer.
    `KafkaReadStream<K,V>` | `batchHandler(Handler<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>> handler)` Set the handler that will be called when a new batch of records is returned from Kafka.
    `void` | `beginningOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,Long>>> handler)` Get the first offset for the given partitions.
    `void` | `beginningOffsets(org.apache.kafka.common.TopicPartition topicPartition, Handler<AsyncResult<Long>> handler)` Get the first offset for the given partition.
    `default void` | `close()` Close the stream
    `void` | `close(Handler<AsyncResult<Void>> completionHandler)` Close the stream
    `void` | `commit()` Commit current offsets for all the subscribed list of topics and partition.
    `void` | `commit(Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>>> completionHandler)` Commit current offsets for all the subscribed list of topics and partition.
    `void` | `commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets)` Commit the specified offsets for the specified list of topics and partitions to Kafka.
    `void` | `commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets, Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>>> completionHandler)` Commit the specified offsets for the specified list of topics and partitions to Kafka.
    `void` | `committed(org.apache.kafka.common.TopicPartition topicPartition, Handler<AsyncResult<org.apache.kafka.clients.consumer.OffsetAndMetadata>> handler)` Get the last committed offset for the given partition (whether the commit happened by this process or another).
    `static <K,V> KafkaReadStream<K,V>` | `create(Vertx vertx, org.apache.kafka.clients.consumer.Consumer<K,V> consumer)` Create a new KafkaReadStream instance
    `static <K,V> KafkaReadStream<K,V>` | `create(Vertx vertx, Map<String,Object> config)` Create a new KafkaReadStream instance
    `static <K,V> KafkaReadStream<K,V>` | `create(Vertx vertx, Map<String,Object> config, Class<K> keyType, Class<V> valueType)` Create a new KafkaReadStream instance
    `static <K,V> KafkaReadStream<K,V>` | `create(Vertx vertx, Map<String,Object> config, org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer, org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)` Create a new KafkaReadStream instance
    `static <K,V> KafkaReadStream<K,V>` | `create(Vertx vertx, Properties config)` Create a new KafkaReadStream instance
    `static <K,V> KafkaReadStream<K,V>` | `create(Vertx vertx, Properties config, Class<K> keyType, Class<V> valueType)` Create a new KafkaReadStream instance
    `static <K,V> KafkaReadStream<K,V>` | `create(Vertx vertx, Properties config, org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer, org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)` Create a new KafkaReadStream instance
    `long` | `demand()` Returns the current demand.
    `KafkaReadStream<K,V>` | `endHandler(Handler<Void> endHandler)` Set an end handler.
    `void` | `endOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,Long>>> handler)` Get the last offset for the given partitions.
    `void` | `endOffsets(org.apache.kafka.common.TopicPartition topicPartition, Handler<AsyncResult<Long>> handler)` Get the last offset for the given partition.
    `KafkaReadStream<K,V>` | `exceptionHandler(Handler<Throwable> handler)` Set an exception handler on the read stream.
    `KafkaReadStream<K,V>` | `fetch(long amount)` Fetch the specified `amount` of elements.
    `KafkaReadStream<K,V>` | `handler(Handler<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> handler)` Set a data handler.
    `KafkaReadStream<K,V>` | `listTopics(Handler<AsyncResult<Map<String,List<org.apache.kafka.common.PartitionInfo>>>> handler)` Get metadata about partitions for all topics that the user is authorized to view.
    `void` | `offsetsForTimes(Map<org.apache.kafka.common.TopicPartition,Long> topicPartitionTimestamps, Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndTimestamp>>> handler)` Look up the offsets for the given partitions by timestamp.
    `void` | `offsetsForTimes(org.apache.kafka.common.TopicPartition topicPartition, long timestamp, Handler<AsyncResult<org.apache.kafka.clients.consumer.OffsetAndTimestamp>> handler)` * Look up the offset for the given partition by timestamp.
    `KafkaReadStream<K,V>` | `partitionsAssignedHandler(Handler<Set<org.apache.kafka.common.TopicPartition>> handler)` Set the handler called when topic partitions are assigned to the consumer
    `KafkaReadStream<K,V>` | `partitionsFor(String topic, Handler<AsyncResult<List<org.apache.kafka.common.PartitionInfo>>> handler)` Get metadata about the partitions for a given topic.
    `KafkaReadStream<K,V>` | `partitionsRevokedHandler(Handler<Set<org.apache.kafka.common.TopicPartition>> handler)` Set the handler called when topic partitions are revoked to the consumer
    `KafkaReadStream<K,V>` | `pause()` Pause the `ReadStream`, it sets the buffer in `fetch` mode and clears the actual demand.
    `KafkaReadStream<K,V>` | `pause(Set<org.apache.kafka.common.TopicPartition> topicPartitions)` Suspend fetching from the requested partitions.
    `KafkaReadStream<K,V>` | `pause(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)` Suspend fetching from the requested partitions.
    `void` | `paused(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)` Get the set of partitions that were previously paused by a call to `pause(Set)`.
    `void` | `poll(java.time.Duration timeout, Handler<AsyncResult<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>> handler)` Executes a poll for getting messages from Kafka.
    `void` | `poll(long timeout, Handler<AsyncResult<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>> handler)` Deprecated. use `poll(Duration, Handler)`
    `KafkaReadStream<K,V>` | `pollTimeout(java.time.Duration timeout)` Sets the poll timeout for the underlying native Kafka Consumer.
    `KafkaReadStream<K,V>` | `pollTimeout(long timeout)` Deprecated. use `pollTimeout(Duration)`
    `void` | `position(org.apache.kafka.common.TopicPartition partition, Handler<AsyncResult<Long>> handler)` Get the offset of the next record that will be fetched (if a record with that offset exists).
    `KafkaReadStream<K,V>` | `resume()` Resume reading, and sets the buffer in `flowing` mode.
    `KafkaReadStream<K,V>` | `resume(Set<org.apache.kafka.common.TopicPartition> topicPartitions)` Resume specified partitions which have been paused with pause.
    `KafkaReadStream<K,V>` | `resume(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)` Resume specified partitions which have been paused with pause.
    `KafkaReadStream<K,V>` | `seek(org.apache.kafka.common.TopicPartition topicPartition, long offset)` Overrides the fetch offsets that the consumer will use on the next poll.
    `KafkaReadStream<K,V>` | `seek(org.apache.kafka.common.TopicPartition topicPartition, long offset, Handler<AsyncResult<Void>> completionHandler)` Overrides the fetch offsets that the consumer will use on the next poll.
    `KafkaReadStream<K,V>` | `seekToBeginning(Set<org.apache.kafka.common.TopicPartition> topicPartitions)` Seek to the first offset for each of the given partitions.
    `KafkaReadStream<K,V>` | `seekToBeginning(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)` Seek to the first offset for each of the given partitions.
    `KafkaReadStream<K,V>` | `seekToEnd(Set<org.apache.kafka.common.TopicPartition> topicPartitions)` Seek to the last offset for each of the given partitions.
    `KafkaReadStream<K,V>` | `seekToEnd(Set<org.apache.kafka.common.TopicPartition> topicPartitions, Handler<AsyncResult<Void>> completionHandler)` Seek to the last offset for each of the given partitions.
    `KafkaReadStream<K,V>` | `subscribe(Pattern pattern)` Subscribe to all topics matching specified pattern to get dynamically assigned partitions.
    `KafkaReadStream<K,V>` | `subscribe(Pattern pattern, Handler<AsyncResult<Void>> completionHandler)` Subscribe to all topics matching specified pattern to get dynamically assigned partitions.
    `KafkaReadStream<K,V>` | `subscribe(Set<String> topics)` Subscribe to the given list of topics to get dynamically assigned partitions.
    `KafkaReadStream<K,V>` | `subscribe(Set<String> topics, Handler<AsyncResult<Void>> completionHandler)` Subscribe to the given list of topics to get dynamically assigned partitions.
    `KafkaReadStream<K,V>` | `subscription(Handler<AsyncResult<Set<String>>> handler)` Get the current subscription.
    `KafkaReadStream<K,V>` | `unsubscribe()` Unsubscribe from topics currently subscribed with subscribe.
    `KafkaReadStream<K,V>` | `unsubscribe(Handler<AsyncResult<Void>> completionHandler)` Unsubscribe from topics currently subscribed with subscribe.
    `org.apache.kafka.clients.consumer.Consumer<K,V>` | `unwrap()`

    - ### Methods inherited from interface io.vertx.core.streams.ReadStream

      `pipe, pipeTo, pipeTo`

- - ### Method Detail

    - #### demand

          long demand()

      Returns the current demand.
      If the stream is in flowing mode will return `Long.MAX_VALUE`.
      - If the stream is in fetch mode, will return the current number of elements still to be delivered or 0 if paused.
      Returns:
        current demand

    - #### create

          static <K,V> KafkaReadStream<K,V> create(Vertx vertx,
                                                   Properties config)

      Create a new KafkaReadStream instance
      Parameters:
        `vertx` - Vert.x instance to use
        `config` - Kafka consumer configuration
      Returns:
        an instance of the KafkaReadStream

    - #### create

          static <K,V> KafkaReadStream<K,V> create(Vertx vertx,
                                                   Properties config,
                                                   Class<K> keyType,
                                                   Class<V> valueType)

      Create a new KafkaReadStream instance
      Parameters:
        `vertx` - Vert.x instance to use
        `config` - Kafka consumer configuration
        `keyType` - class type for the key deserialization
        `valueType` - class type for the value deserialization
      Returns:
        an instance of the KafkaReadStream

    - #### create

          static <K,V> KafkaReadStream<K,V> create(Vertx vertx,
                                                   Properties config,
                                                   org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer,
                                                   org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)

      Create a new KafkaReadStream instance
      Parameters:
        `vertx` - Vert.x instance to use
        `config` - Kafka consumer configuration
        `keyDeserializer` - key deserializer
        `valueDeserializer` - value deserializer
      Returns:
        an instance of the KafkaReadStream

    - #### create

          static <K,V> KafkaReadStream<K,V> create(Vertx vertx,
                                                   Map<String,Object> config)

      Create a new KafkaReadStream instance
      Parameters:
        `vertx` - Vert.x instance to use
        `config` - Kafka consumer configuration
      Returns:
        an instance of the KafkaReadStream

    - #### create

          static <K,V> KafkaReadStream<K,V> create(Vertx vertx,
                                                   Map<String,Object> config,
                                                   Class<K> keyType,
                                                   Class<V> valueType)

      Create a new KafkaReadStream instance
      Parameters:
        `vertx` - Vert.x instance to use
        `config` - Kafka consumer configuration
        `keyType` - class type for the key deserialization
        `valueType` - class type for the value deserialization
      Returns:
        an instance of the KafkaReadStream

    - #### exceptionHandler

          KafkaReadStream<K,V> exceptionHandler(Handler<Throwable> handler)

      Description copied from interface: `ReadStream`
      Set an exception handler on the read stream.
      Specified by:
        `exceptionHandler` in interface `ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>`
      Specified by:
        `exceptionHandler` in interface `StreamBase`
      Parameters:
        `handler` - the exception handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### handler

          KafkaReadStream<K,V> handler(Handler<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> handler)

      Description copied from interface: `ReadStream`
      Set a data handler. As data is read, the handler will be called with the data.
      Specified by:
        `handler` in interface `ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### pause

          KafkaReadStream<K,V> pause()

      Description copied from interface: `ReadStream`
      Pause the `ReadStream`, it sets the buffer in `fetch` mode and clears the actual demand.

      While it's paused, no data will be sent to the data `handler`.

      Specified by:
        `pause` in interface `ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### resume

          KafkaReadStream<K,V> resume()

      Description copied from interface: `ReadStream`
      Resume reading, and sets the buffer in `flowing` mode.

      If the `ReadStream` has been paused, reading will recommence on it.
      Specified by:
        `resume` in interface `ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### fetch

          KafkaReadStream<K,V> fetch(long amount)

      Description copied from interface: `ReadStream`
      Fetch the specified `amount` of elements. If the `ReadStream` has been paused, reading will recommence with the specified `amount` of items, otherwise the specified `amount` will be added to the current stream demand.
      Specified by:
        `fetch` in interface `ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### endHandler

          KafkaReadStream<K,V> endHandler(Handler<Void> endHandler)

      Description copied from interface: `ReadStream`
      Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.
      Specified by:
        `endHandler` in interface `ReadStream<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### create

          static <K,V> KafkaReadStream<K,V> create(Vertx vertx,
                                                   Map<String,Object> config,
                                                   org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer,
                                                   org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)

      Create a new KafkaReadStream instance
      Parameters:
        `vertx` - Vert.x instance to use
        `config` - Kafka consumer configuration
        `keyDeserializer` - key deserializer
        `valueDeserializer` - value deserializer
      Returns:
        an instance of the KafkaReadStream

    - #### create

          static <K,V> KafkaReadStream<K,V> create(Vertx vertx,
                                                   org.apache.kafka.clients.consumer.Consumer<K,V> consumer)

      Create a new KafkaReadStream instance
      Parameters:
        `vertx` - Vert.x instance to use
        `consumer` - native Kafka consumer instance
      Returns:
        an instance of the KafkaReadStream

    - #### committed

          void committed(org.apache.kafka.common.TopicPartition topicPartition,
                         Handler<AsyncResult<org.apache.kafka.clients.consumer.OffsetAndMetadata>> handler)

      Get the last committed offset for the given partition (whether the commit happened by this process or another).
      Parameters:
        `topicPartition` - topic partition for getting last committed offset
        `handler` - handler called on operation completed

    - #### pause

          KafkaReadStream<K,V> pause(Set<org.apache.kafka.common.TopicPartition> topicPartitions)

      Suspend fetching from the requested partitions.
      Parameters:
        `topicPartitions` - topic partition from which suspend fetching
      Returns:
        current KafkaReadStream instance

    - #### pause

          KafkaReadStream<K,V> pause(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
                                     Handler<AsyncResult<Void>> completionHandler)

      Suspend fetching from the requested partitions.

      Due to internal buffering of messages, the record handler will continue to observe messages from the given `topicPartitions` until some time after the given `completionHandler` is called. In contrast, the once the given `completionHandler` is called the `batchHandler(Handler)` will not see messages from the given `topicPartitions`.

      Parameters:
        `topicPartitions` - topic partition from which suspend fetching
        `completionHandler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### paused

          void paused(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)

      Get the set of partitions that were previously paused by a call to `pause(Set)`.
      Parameters:
        `handler` - handler called on operation completed

    - #### resume

          KafkaReadStream<K,V> resume(Set<org.apache.kafka.common.TopicPartition> topicPartitions)

      Resume specified partitions which have been paused with pause.
      Parameters:
        `topicPartitions` - topic partition from which resume fetching
      Returns:
        current KafkaReadStream instance

    - #### resume

          KafkaReadStream<K,V> resume(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
                                      Handler<AsyncResult<Void>> completionHandler)

      Resume specified partitions which have been paused with pause.
      Parameters:
        `topicPartitions` - topic partition from which resume fetching
        `completionHandler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### seekToEnd

          KafkaReadStream<K,V> seekToEnd(Set<org.apache.kafka.common.TopicPartition> topicPartitions)

      Seek to the last offset for each of the given partitions.
      Parameters:
        `topicPartitions` - topic partition for which seek
      Returns:
        current KafkaReadStream instance

    - #### seekToEnd

          KafkaReadStream<K,V> seekToEnd(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
                                         Handler<AsyncResult<Void>> completionHandler)

      Seek to the last offset for each of the given partitions.

      Due to internal buffering of messages, the record handler will continue to observe messages fetched with respect to the old offset until some time after the given `completionHandler` is called. In contrast, the once the given `completionHandler` is called the `batchHandler(Handler)` will only see messages consistent with the new offset.

      Parameters:
        `topicPartitions` - topic partition for which seek
        `completionHandler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### seekToBeginning

          KafkaReadStream<K,V> seekToBeginning(Set<org.apache.kafka.common.TopicPartition> topicPartitions)

      Seek to the first offset for each of the given partitions.
      Parameters:
        `topicPartitions` - topic partition for which seek
      Returns:
        current KafkaReadStream instance

    - #### seekToBeginning

          KafkaReadStream<K,V> seekToBeginning(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
                                               Handler<AsyncResult<Void>> completionHandler)

      Seek to the first offset for each of the given partitions.

      Due to internal buffering of messages, the record handler will continue to observe messages fetched with respect to the old offset until some time after the given `completionHandler` is called. In contrast, the once the given `completionHandler` is called the `batchHandler(Handler)` will only see messages consistent with the new offset.

      Parameters:
        `topicPartitions` - topic partition for which seek
        `completionHandler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### seek

          KafkaReadStream<K,V> seek(org.apache.kafka.common.TopicPartition topicPartition,
                                    long offset)

      Overrides the fetch offsets that the consumer will use on the next poll.
      Parameters:
        `topicPartition` - topic partition for which seek
        `offset` - offset to seek inside the topic partition
      Returns:
        current KafkaReadStream instance

    - #### seek

          KafkaReadStream<K,V> seek(org.apache.kafka.common.TopicPartition topicPartition,
                                    long offset,
                                    Handler<AsyncResult<Void>> completionHandler)

      Overrides the fetch offsets that the consumer will use on the next poll.

      Due to internal buffering of messages, the record handler will continue to observe messages fetched with respect to the old offset until some time after the given `completionHandler` is called. In contrast, the once the given `completionHandler` is called the `batchHandler(Handler)` will only see messages consistent with the new offset.

      Parameters:
        `topicPartition` - topic partition for which seek
        `offset` - offset to seek inside the topic partition
        `completionHandler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### partitionsRevokedHandler

          KafkaReadStream<K,V> partitionsRevokedHandler(Handler<Set<org.apache.kafka.common.TopicPartition>> handler)

      Set the handler called when topic partitions are revoked to the consumer
      Parameters:
        `handler` - handler called on revoked topic partitions
      Returns:
        current KafkaReadStream instance

    - #### partitionsAssignedHandler

          KafkaReadStream<K,V> partitionsAssignedHandler(Handler<Set<org.apache.kafka.common.TopicPartition>> handler)

      Set the handler called when topic partitions are assigned to the consumer
      Parameters:
        `handler` - handler called on assigned topic partitions
      Returns:
        current KafkaReadStream instance

    - #### subscribe

          KafkaReadStream<K,V> subscribe(Set<String> topics)

      Subscribe to the given list of topics to get dynamically assigned partitions.
      Parameters:
        `topics` - topics to subscribe to
      Returns:
        current KafkaReadStream instance

    - #### subscribe

          KafkaReadStream<K,V> subscribe(Set<String> topics,
                                         Handler<AsyncResult<Void>> completionHandler)

      Subscribe to the given list of topics to get dynamically assigned partitions.

      Due to internal buffering of messages, when changing the subscribed topics the old set of topics may remain in effect (as observed by the handler(Handler) record handler}) until some time after the given `completionHandler` is called. In contrast, the once the given `completionHandler` is called the `batchHandler(Handler)` will only see messages consistent with the new set of topics.

      Parameters:
        `topics` - topics to subscribe to
        `completionHandler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### subscribe

          KafkaReadStream<K,V> subscribe(Pattern pattern,
                                         Handler<AsyncResult<Void>> completionHandler)

      Subscribe to all topics matching specified pattern to get dynamically assigned partitions.

      Due to internal buffering of messages, when changing the subscribed topics the old set of topics may remain in effect (as observed by the handler(Handler) record handler}) until some time after the given `completionHandler` is called. In contrast, the once the given `completionHandler` is called the `batchHandler(Handler)` will only see messages consistent with the new set of topics.

      Parameters:
        `pattern` - Pattern to subscribe to
        `completionHandler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### subscribe

          KafkaReadStream<K,V> subscribe(Pattern pattern)

      Subscribe to all topics matching specified pattern to get dynamically assigned partitions.
      Parameters:
        `pattern` - Pattern to subscribe to
      Returns:
        current KafkaReadStream instance

    - #### unsubscribe

          KafkaReadStream<K,V> unsubscribe()

      Unsubscribe from topics currently subscribed with subscribe.
      Returns:
        current KafkaReadStream instance

    - #### unsubscribe

          KafkaReadStream<K,V> unsubscribe(Handler<AsyncResult<Void>> completionHandler)

      Unsubscribe from topics currently subscribed with subscribe.
      Parameters:
        `completionHandler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### subscription

          KafkaReadStream<K,V> subscription(Handler<AsyncResult<Set<String>>> handler)

      Get the current subscription.
      Parameters:
        `handler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### assign

          KafkaReadStream<K,V> assign(Set<org.apache.kafka.common.TopicPartition> partitions)

      Manually assign a set of partitions to this consumer.
      Parameters:
        `partitions` - partitions which want assigned
      Returns:
        current KafkaReadStream instance

    - #### assign

          KafkaReadStream<K,V> assign(Set<org.apache.kafka.common.TopicPartition> partitions,
                                      Handler<AsyncResult<Void>> completionHandler)

      Manually assign a set of partitions to this consumer.

      Due to internal buffering of messages, when reassigning the old set of partitions may remain in effect (as observed by the handler(Handler) record handler)} until some time after the given `completionHandler` is called. In contrast, the once the given `completionHandler` is called the `batchHandler(Handler)` will only see messages consistent with the new set of partitions.

      Parameters:
        `partitions` - partitions which want assigned
        `completionHandler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### assignment

          KafkaReadStream<K,V> assignment(Handler<AsyncResult<Set<org.apache.kafka.common.TopicPartition>>> handler)

      Get the set of partitions currently assigned to this consumer.
      Parameters:
        `handler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### listTopics

          KafkaReadStream<K,V> listTopics(Handler<AsyncResult<Map<String,List<org.apache.kafka.common.PartitionInfo>>>> handler)

      Get metadata about partitions for all topics that the user is authorized to view.
      Parameters:
        `handler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### commit

          void commit()

      Commit current offsets for all the subscribed list of topics and partition.

    - #### commit

          void commit(Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>>> completionHandler)

      Commit current offsets for all the subscribed list of topics and partition.
      Parameters:
        `completionHandler` - handler called on operation completed

    - #### commit

          void commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets)

      Commit the specified offsets for the specified list of topics and partitions to Kafka.
      Parameters:
        `offsets` - offsets list to commit

    - #### commit

          void commit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets,
                      Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>>> completionHandler)

      Commit the specified offsets for the specified list of topics and partitions to Kafka.
      Parameters:
        `offsets` - offsets list to commit
        `completionHandler` - handler called on operation completed

    - #### partitionsFor

          KafkaReadStream<K,V> partitionsFor(String topic,
                                             Handler<AsyncResult<List<org.apache.kafka.common.PartitionInfo>>> handler)

      Get metadata about the partitions for a given topic.
      Parameters:
        `topic` - topic partition for which getting partitions info
        `handler` - handler called on operation completed
      Returns:
        current KafkaReadStream instance

    - #### close

          default void close()

      Close the stream

    - #### close

          void close(Handler<AsyncResult<Void>> completionHandler)

      Close the stream
      Parameters:
        `completionHandler` - handler called on operation completed

    - #### position

          void position(org.apache.kafka.common.TopicPartition partition,
                        Handler<AsyncResult<Long>> handler)

      Get the offset of the next record that will be fetched (if a record with that offset exists).
      Parameters:
        `partition` - The partition to get the position for
        `handler` - handler called on operation completed

    - #### offsetsForTimes

          void offsetsForTimes(Map<org.apache.kafka.common.TopicPartition,Long> topicPartitionTimestamps,
                               Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndTimestamp>>> handler)

      Look up the offsets for the given partitions by timestamp.
      Parameters:
        `topicPartitionTimestamps` - A map with pairs of (TopicPartition, Timestamp).
        `handler` - handler called on operation completed

    - #### offsetsForTimes

          void offsetsForTimes(org.apache.kafka.common.TopicPartition topicPartition,
                               long timestamp,
                               Handler<AsyncResult<org.apache.kafka.clients.consumer.OffsetAndTimestamp>> handler)

      * Look up the offset for the given partition by timestamp.
      Parameters:
        `topicPartition` - Partition to query.
        `timestamp` - Timestamp used to determine the offset.
        `handler` - handler called on operation completed

    - #### beginningOffsets

          void beginningOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
                                Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,Long>>> handler)

      Get the first offset for the given partitions.
      Parameters:
        `topicPartitions` - the partitions to get the earliest offsets.
        `handler` - handler called on operation completed. Returns the earliest available offsets for the given partitions

    - #### beginningOffsets

          void beginningOffsets(org.apache.kafka.common.TopicPartition topicPartition,
                                Handler<AsyncResult<Long>> handler)

      Get the first offset for the given partition.
      Parameters:
        `topicPartition` - the partition to get the earliest offset.
        `handler` - handler called on operation completed. Returns the earliest available offset for the given partition

    - #### endOffsets

          void endOffsets(Set<org.apache.kafka.common.TopicPartition> topicPartitions,
                          Handler<AsyncResult<Map<org.apache.kafka.common.TopicPartition,Long>>> handler)

      Get the last offset for the given partitions. The last offset of a partition is the offset of the upcoming message, i.e. the offset of the last available message + 1.
      Parameters:
        `topicPartitions` - the partitions to get the end offsets.
        `handler` - handler called on operation completed. The end offsets for the given partitions.

    - #### endOffsets

          void endOffsets(org.apache.kafka.common.TopicPartition topicPartition,
                          Handler<AsyncResult<Long>> handler)

      Get the last offset for the given partition. The last offset of a partition is the offset of the upcoming message, i.e. the offset of the last available message + 1.
      Parameters:
        `topicPartition` - the partition to get the end offset.
        `handler` - handler called on operation completed. The end offset for the given partition.

    - #### unwrap

          org.apache.kafka.clients.consumer.Consumer<K,V> unwrap()

      Returns:
        the underlying consumer

    - #### batchHandler

          KafkaReadStream<K,V> batchHandler(Handler<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>> handler)

      Set the handler that will be called when a new batch of records is returned from Kafka. Batch handlers need to take care not to block the event loop when dealing with large batches. It is better to process records individually using the `record handler`.
      Parameters:
        `handler` - handler called each time Kafka returns a batch of records.
      Returns:
        current KafkaReadStream instance.

    - #### pollTimeout

          KafkaReadStream<K,V> pollTimeout(java.time.Duration timeout)

      Sets the poll timeout for the underlying native Kafka Consumer. Defaults to 1000 ms. Setting timeout to a lower value results in a more 'responsive' client, because it will block for a shorter period if no data is available in the assigned partition and therefore allows subsequent actions to be executed with a shorter delay. At the same time, the client will poll more frequently and thus will potentially create a higher load on the Kafka Broker.
      Parameters:
        `timeout` - The time, spent waiting in poll if data is not available in the buffer. If 0, returns immediately with any records that are available currently in the native Kafka consumer's buffer, else returns empty. Must not be negative.

    - #### pollTimeout

          @Deprecated
          KafkaReadStream<K,V> pollTimeout(long timeout)

      Deprecated. use `pollTimeout(Duration)`
      Sets the poll timeout (in ms) for the underlying native Kafka Consumer. Defaults to 1000.

    - #### poll

          @Deprecated
          void poll(long timeout,
                                Handler<AsyncResult<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>> handler)

      Deprecated. use `poll(Duration, Handler)`
      Executes a poll for getting messages from Kafka
      Parameters:
        `timeout` - The time, in milliseconds, spent waiting in poll if data is not available in the buffer. If 0, returns immediately with any records that are available currently in the native Kafka consumer's buffer, else returns empty. Must not be negative.
        `handler` - handler called after the poll with batch of records (can be empty).

    - #### poll

          void poll(java.time.Duration timeout,
                    Handler<AsyncResult<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>> handler)

      Executes a poll for getting messages from Kafka.
      Parameters:
        `timeout` - The maximum time to block (must not be greater than `Long.MAX_VALUE` milliseconds)
        `handler` - handler called after the poll with batch of records (can be empty).

Copyright © 2022 Eclipse. All rights reserved.