com.taosdata.jdbc.tmq

## Class TaosConsumer<V>

- java.lang.Object
- - com.taosdata.jdbc.tmq.TaosConsumer<V>

All Implemented Interfaces:
  AutoCloseable

    public class TaosConsumer<V>
    extends Object
    implements AutoCloseable

### Constructor Summary

Constructors
Constructor and Description
`TaosConsumer(Properties properties)` Note: after creating a `TaosConsumer` you must always `close()` it to avoid resource leaks.

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`Set<TopicPartition>` `assignment()`
`Map<TopicPartition,Long>` `beginningOffsets(String topic)`
`void` `close()`
`void` `commitAsync()`
`void` `commitAsync(Map<TopicPartition,OffsetAndMetadata> offsets, OffsetCommitCallback<V> callback)`
`void` `commitAsync(OffsetCommitCallback<V> callback)`
`void` `commitCallbackHandler(int code)` Deprecated.
`void` `commitSync()`
`void` `commitSync(Map<TopicPartition,OffsetAndMetadata> offsets)`
`Map<TopicPartition,OffsetAndMetadata>` `committed(Set<TopicPartition> partitions)`
`OffsetAndMetadata` `committed(TopicPartition partition)`
`Map<TopicPartition,Long>` `endOffsets(String topic)`
`ConsumerRecords<V>` `poll(Duration timeout)`
`Map<TopicPartition,Long>` `position(String topic)`
`long` `position(TopicPartition tp)`
`void` `seek(TopicPartition partition, long offset)`
`void` `seekToBeginning(Collection<TopicPartition> partitions)`
`void` `seekToEnd(Collection<TopicPartition> partitions)`
`void` `subscribe(Collection<String> topics)`
`Set<String>` `subscription()`
`void` `unsubscribe()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### TaosConsumer

    public TaosConsumer(Properties properties)
                 throws SQLException

Note: after creating a `TaosConsumer` you must always `close()` it to avoid resource leaks.

Throws:
  `SQLException`

### Method Detail

#### subscribe

    public void subscribe(Collection<String> topics)
                   throws SQLException

Throws:
  `SQLException`

#### unsubscribe

    public void unsubscribe()
                     throws SQLException

Throws:
  `SQLException`

#### subscription

    public Set<String> subscription()
                             throws SQLException

Throws:
  `SQLException`

#### poll

    public ConsumerRecords<V> poll(Duration timeout)
                            throws SQLException

Throws:
  `SQLException`

#### commitCallbackHandler

    @Deprecated
    public void commitCallbackHandler(int code)

Deprecated.
jni consumer will call back whit error code when commit async

Parameters:
  `code` - error code

#### commitAsync

    public void commitAsync()
                     throws SQLException

Throws:
  `SQLException`

#### commitAsync

    public void commitAsync(OffsetCommitCallback<V> callback)
                     throws SQLException

Throws:
  `SQLException`

#### commitAsync

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

Throws:
  `SQLException`

#### commitSync

    public void commitSync()
                    throws SQLException

Throws:
  `SQLException`

#### commitSync

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

Throws:
  `SQLException`

#### seek

    public void seek(TopicPartition partition,
                     long offset)
              throws SQLException

Throws:
  `SQLException`

#### position

    public long position(TopicPartition tp)
                  throws SQLException

Throws:
  `SQLException`

#### position

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

Throws:
  `SQLException`

#### beginningOffsets

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

Throws:
  `SQLException`

#### endOffsets

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

Throws:
  `SQLException`

#### seekToBeginning

    public void seekToBeginning(Collection<TopicPartition> partitions)
                         throws SQLException

Throws:
  `SQLException`

#### seekToEnd

    public void seekToEnd(Collection<TopicPartition> partitions)
                   throws SQLException

Throws:
  `SQLException`

#### assignment

    public Set<TopicPartition> assignment()
                                   throws SQLException

Throws:
  `SQLException`

#### committed

    public OffsetAndMetadata committed(TopicPartition partition)
                                throws SQLException

Throws:
  `SQLException`

#### committed

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

Throws:
  `SQLException`

#### close

    public void close()
               throws SQLException

Specified by:
  `close` in interface `AutoCloseable`
Throws:
  `SQLException`