# Class: KafkaConsumer

## vertx-kafka-client-js/kafka_consumer~ KafkaConsumer

#### new KafkaConsumer()

Vert.x Kafka consumer.

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 35

### Methods

#### assign(topicPartitions, completionHandler) → {KafkaConsumer}

Manually assign a list of partition to this consumer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`topicPartitions` | Array.<Object> | partitions which want assigned
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 214

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### assignment(handler) → {KafkaConsumer}

Get the set of partitions currently assigned to this consumer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 250

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### close(completionHandler)

Close the consumer

##### Parameters:

Name | Type | Description
--- | --- | ---
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 531

#### commit(completionHandler)

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

##### Parameters:

Name | Type | Description
--- | --- | ---
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 468

#### committed(topicPartition, handler)

Get the last committed offset for the given partition (whether the commit happened by this process or another).

##### Parameters:

Name | Type | Description
--- | --- | ---
`topicPartition` | Object | topic partition for getting last committed offset
`handler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 490

#### endHandler(endHandler) → {KafkaConsumer}

##### Parameters:

Name | Type | Description
--- | --- | ---
`endHandler` | function |

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 161

##### Returns:

Type
  KafkaConsumer

#### exceptionHandler(handler) → {KafkaConsumer}

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 49

##### Returns:

Type
  KafkaConsumer

#### handler(handler) → {KafkaConsumer}

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 65

##### Returns:

Type
  KafkaConsumer

#### partitionsAssignedHandler(handler) → {KafkaConsumer}

Set the handler called when topic partitions are assigned to the consumer

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function | handler called on assigned topic partitions

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 352

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### partitionsFor(topic, handler) → {KafkaConsumer}

Get metadata about the partitions for a given topic.

##### Parameters:

Name | Type | Description
--- | --- | ---
`topic` | string | topic partition for which getting partitions info
`handler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 511

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### partitionsRevokedHandler(handler) → {KafkaConsumer}

Set the handler called when topic partitions are revoked to the consumer

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function | handler called on revoked topic partitions

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 335

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### pause(topicPartitions, completionHandler) → {KafkaConsumer}

Suspend fetching from the requested partitions.

##### Parameters:

Name | Type | Description
--- | --- | ---
`topicPartitions` | Array.<Object> | topic partition from which suspend fetching
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 83

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### paused(handler)

Get the set of partitions that were previously paused by a call to pause(Set).

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 315

#### position(partition, handler)

Get the offset of the next record that will be fetched (if a record with that offset exists).

##### Parameters:

Name | Type | Description
--- | --- | ---
`partition` | Object | The partition to get the position for
`handler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 553

#### resume(topicPartitions, completionHandler) → {KafkaConsumer}

Resume specified partitions which have been paused with pause.

##### Parameters:

Name | Type | Description
--- | --- | ---
`topicPartitions` | Array.<Object> | topic partition from which resume fetching
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 123

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### seek(topicPartition, offset, completionHandler) → {KafkaConsumer}

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

##### Parameters:

Name | Type | Description
--- | --- | ---
`topicPartition` | Object | topic partition for which seek
`offset` | number | offset to seek inside the topic partition
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 371

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### seekToBeginning(topicPartitions, completionHandler) → {KafkaConsumer}

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

##### Parameters:

Name | Type | Description
--- | --- | ---
`topicPartitions` | Array.<Object> | topic partition for which seek
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 396

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### seekToEnd(topicPartitions, completionHandler) → {KafkaConsumer}

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

##### Parameters:

Name | Type | Description
--- | --- | ---
`topicPartitions` | Array.<Object> | topic partition for which seek
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 433

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### subscribe(topics, completionHandler) → {KafkaConsumer}

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

##### Parameters:

Name | Type | Description
--- | --- | ---
`topics` | Array.<string> | topics to subscribe to
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 177

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### subscription(handler) → {KafkaConsumer}

Get the current subscription.

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 295

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer

#### unsubscribe(completionHandler) → {KafkaConsumer}

Unsubscribe from topics currently subscribed with subscribe.

##### Parameters:

Name | Type | Description
--- | --- | ---
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_consumer.js, line 271

##### Returns:

current KafkaConsumer instance

Type
  KafkaConsumer