com.taosdata.jdbc.common

## Interface Consumer<V>

All Known Implementing Classes:
  JNIConsumer, WSConsumer

    public interface Consumer<V>

### Method Summary

All Methods Instance Methods Abstract Methods
`Set<TopicPartition>` `assignment()` Get the set of partitions currently assigned to this consumer.
`Map<TopicPartition,Long>` `beginningOffsets(String topic)`
`void` `close()` close consumer
`void` `commitAsync(Map<TopicPartition,OffsetAndMetadata> offsets, OffsetCommitCallback<V> callback)`
`void` `commitAsync(OffsetCommitCallback<V> callback)`
`void` `commitSync()` commit offset with sync
`void` `commitSync(Map<TopicPartition,OffsetAndMetadata> offsets)`
`Map<TopicPartition,OffsetAndMetadata>` `committed(Set<TopicPartition> partitions)`
`OffsetAndMetadata` `committed(TopicPartition partition)` Get the last committed offset for the given partition.
`void` `create(Properties properties)` create consumer
`Map<TopicPartition,Long>` `endOffsets(String topic)`
`ConsumerRecords<V>` `poll(Duration timeout, Deserializer<V> deserializer)` get result records
`Map<TopicPartition,Long>` `position(String topic)`
`long` `position(TopicPartition partition)` Get the offset of the next record that will be fetched.
`void` `seek(TopicPartition partition, long offset)` If this API is invoked for the same partition more than once, the latest offset will be used on the next poll().
`void` `seekToBeginning(Collection<TopicPartition> partitions)`
`void` `seekToEnd(Collection<TopicPartition> partitions)`
`void` `subscribe(Collection<String> topics)` subscribe topics
`Set<String>` `subscription()` get subscribe topics
`void` `unsubscribe()` unsubscribe topics

### Method Detail

#### create

    void create(Properties properties)
         throws SQLException

create consumer

Parameters:
  `properties` - ip / port / user / password and so on.
Throws:
  `SQLException` - jni exception

#### subscribe

    void subscribe(Collection<String> topics)
            throws SQLException

subscribe topics

Parameters:
  `topics` - collection of topics
Throws:
  `SQLException`

#### unsubscribe

    void unsubscribe()
              throws SQLException

unsubscribe topics

Throws:
  `SQLException`

#### subscription

    Set<String> subscription()
                      throws SQLException

get subscribe topics

Returns:
  topic set
Throws:
  `SQLException`

#### poll

    ConsumerRecords<V> poll(Duration timeout,
                            Deserializer<V> deserializer)
                     throws SQLException

get result records

Parameters:
  `timeout` - wait time for poll data
  `deserializer` - convert resultSet to javaBean
Returns:
  ConsumerRecord is the collection of javaBean
Throws:
  `SQLException` - java reflect exception or resultSet convert exception

#### commitSync

    void commitSync()
             throws SQLException

commit offset with sync

Throws:
  `SQLException`

#### close

    void close()
        throws SQLException

close consumer

Throws:
  `SQLException`

#### commitAsync

    void commitAsync(OffsetCommitCallback<V> callback)
              throws SQLException

Throws:
  `SQLException`

#### seek

    void seek(TopicPartition partition,
              long offset)
       throws SQLException

If this API is invoked for the same partition more than once, the latest offset will be used on the next poll().

Throws:
  `SQLException`

#### position

    long position(TopicPartition partition)
           throws SQLException

Get the offset of the next record that will be fetched.

Throws:
  `SQLException`

#### position

    Map<TopicPartition,Long> position(String topic)
                               throws SQLException

Throws:
  `SQLException`

#### beginningOffsets

    Map<TopicPartition,Long> beginningOffsets(String topic)
                                       throws SQLException

Throws:
  `SQLException`

#### endOffsets

    Map<TopicPartition,Long> endOffsets(String topic)
                                 throws SQLException

Throws:
  `SQLException`

#### seekToBeginning

    void seekToBeginning(Collection<TopicPartition> partitions)
                  throws SQLException

Throws:
  `SQLException`

#### seekToEnd

    void seekToEnd(Collection<TopicPartition> partitions)
            throws SQLException

Throws:
  `SQLException`

#### assignment

    Set<TopicPartition> assignment()
                            throws SQLException

Get the set of partitions currently assigned to this consumer.

Throws:
  `SQLException`

#### committed

    OffsetAndMetadata committed(TopicPartition partition)
                         throws SQLException

Get the last committed offset for the given partition. This offset will be used as the position for the consumer in the event of a failure.

Throws:
  `SQLException`

#### committed

    Map<TopicPartition,OffsetAndMetadata> committed(Set<TopicPartition> partitions)
                                             throws SQLException

Throws:
  `SQLException`

#### commitSync

    void commitSync(Map<TopicPartition,OffsetAndMetadata> offsets)
             throws SQLException

Throws:
  `SQLException`

#### commitAsync

    void commitAsync(Map<TopicPartition,OffsetAndMetadata> offsets,
                     OffsetCommitCallback<V> callback)