| 构造器和说明 |
|---|
WSConsumer() |
| 限定符和类型 | 方法和说明 |
|---|---|
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
|
public void create(Properties properties) throws SQLException
Consumercreate 在接口中 Consumer<V>properties - ip / port / user / password and so on.SQLException - jni exceptionpublic void subscribe(Collection<String> topics) throws SQLException
Consumersubscribe 在接口中 Consumer<V>topics - collection of topicsSQLException - jni exceptionpublic void unsubscribe()
throws SQLException
Consumerunsubscribe 在接口中 Consumer<V>SQLException - jni exceptionpublic Set<String> subscription() throws SQLException
Consumersubscription 在接口中 Consumer<V>SQLException - jni exceptionpublic ConsumerRecords<V> poll(Duration timeout, Deserializer<V> deserializer) throws SQLException
Consumerpoll 在接口中 Consumer<V>timeout - wait time for poll datadeserializer - convert resultSet to javaBeanSQLException - java reflect exception or resultSet convert exceptionpublic void commitSync()
throws SQLException
ConsumercommitSync 在接口中 Consumer<V>SQLException - jni exceptionpublic void close()
throws SQLException
Consumerclose 在接口中 Consumer<V>SQLException - jni exceptionpublic void commitAsync(OffsetCommitCallback<V> callback)
commitAsync 在接口中 Consumer<V>public void seek(TopicPartition partition, long offset) throws SQLException
Consumerseek 在接口中 Consumer<V>SQLExceptionpublic long position(TopicPartition partition) throws SQLException
position 在接口中 Consumer<V>SQLExceptionpublic Map<TopicPartition,Long> position(String topic) throws SQLException
position 在接口中 Consumer<V>SQLExceptionpublic Map<TopicPartition,Long> beginningOffsets(String topic) throws SQLException
beginningOffsets 在接口中 Consumer<V>SQLExceptionpublic Map<TopicPartition,Long> endOffsets(String topic) throws SQLException
endOffsets 在接口中 Consumer<V>SQLExceptionCopyright © 2023. All rights reserved.