public interface Consumer<V>
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
close consumer
|
void |
commitAsync(OffsetCommitCallback<V> callback) |
void |
commitSync()
commit offset with sync
|
void |
create(Properties properties)
create consumer
|
ConsumerRecords<V> |
poll(Duration timeout,
Deserializer<V> deserializer)
get result records
|
void |
subscribe(Collection<String> topics)
subscribe topics
|
Set<String> |
subscription()
get subscribe topics
|
void |
unsubscribe()
unsubscribe topics
|
void create(Properties properties) throws SQLException
properties - ip / port / user / password and so on.SQLException - jni exceptionvoid subscribe(Collection<String> topics) throws SQLException
topics - collection of topicsSQLException - jni exceptionvoid unsubscribe()
throws SQLException
SQLException - jni exceptionSet<String> subscription() throws SQLException
SQLException - jni exceptionConsumerRecords<V> poll(Duration timeout, Deserializer<V> deserializer) throws SQLException
timeout - wait time for poll datadeserializer - convert resultSet to javaBeanSQLException - java reflect exception or resultSet convert exceptionvoid commitSync()
throws SQLException
SQLException - jni exceptionvoid close()
throws SQLException
SQLException - jni exceptionvoid commitAsync(OffsetCommitCallback<V> callback)
Copyright © 2023. All rights reserved.