com.taosdata.jdbc.common

## 接口 Consumer<V>

所有已知实现类:
  JNIConsumer, WSConsumer

    public interface Consumer<V>

### 方法概要

所有方法 实例方法 抽象方法
`Map<TopicPartition,Long>` `beginningOffsets(String topic)`
`void` `close()` close consumer
`void` `commitAsync(OffsetCommitCallback<V> callback)`
`void` `commitSync()` commit offset with sync
`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)`
`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` `subscribe(Collection<String> topics)` subscribe topics
`Set<String>` `subscription()` get subscribe topics
`void` `unsubscribe()` unsubscribe topics

### 方法详细资料

#### create

    void create(Properties properties)
         throws SQLException

create consumer

参数:
  `properties` - ip / port / user / password and so on.
抛出:
  `SQLException` - jni exception

#### subscribe

    void subscribe(Collection<String> topics)
            throws SQLException

subscribe topics

参数:
  `topics` - collection of topics
抛出:
  `SQLException` - jni exception

#### unsubscribe

    void unsubscribe()
              throws SQLException

unsubscribe topics

抛出:
  `SQLException` - jni exception

#### subscription

    Set<String> subscription()
                      throws SQLException

get subscribe topics

返回:
  topic set
抛出:
  `SQLException` - jni exception

#### poll

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

get result records

参数:
  `timeout` - wait time for poll data
  `deserializer` - convert resultSet to javaBean
返回:
  ConsumerRecord is the collection of javaBean
抛出:
  `SQLException` - java reflect exception or resultSet convert exception

#### commitSync

    void commitSync()
             throws SQLException

commit offset with sync

抛出:
  `SQLException` - jni exception

#### close

    void close()
        throws SQLException

close consumer

抛出:
  `SQLException` - jni exception

#### commitAsync

    void commitAsync(OffsetCommitCallback<V> callback)

#### 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().

抛出:
  `SQLException`

#### position

    long position(TopicPartition partition)
           throws SQLException

抛出:
  `SQLException`

#### position

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

抛出:
  `SQLException`

#### beginningOffsets

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

抛出:
  `SQLException`

#### endOffsets

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

抛出:
  `SQLException`