| 构造器和说明 |
|---|
JNIConsumer() |
| 限定符和类型 | 方法和说明 |
|---|---|
Map<TopicPartition,Long> |
beginningOffsets(String topic) |
void |
close()
close consumer
|
void |
closeOffset(long prt) |
void |
commitAsync(OffsetCommitCallback<V> callback) |
void |
commitSync()
commit offset with sync
|
void |
create(Properties properties)
create consumer
|
Map<TopicPartition,Long> |
endOffsets(String topic) |
String |
getErrMsg(int code) |
ConsumerRecords<V> |
poll(Duration timeout,
Deserializer<V> deserializer)
get result records
|
Map<TopicPartition,Long> |
position(String topic) |
long |
position(TopicPartition partition) |
void |
releaseResultSet(long ptr) |
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 commitAsync(OffsetCommitCallback<V> callback)
commitAsync 在接口中 Consumer<V>public void seek(TopicPartition partition, long offset)
Consumerpublic long position(TopicPartition partition)
public Map<TopicPartition,Long> beginningOffsets(String topic)
beginningOffsets 在接口中 Consumer<V>public Map<TopicPartition,Long> endOffsets(String topic)
endOffsets 在接口中 Consumer<V>public void commitSync()
throws SQLException
ConsumercommitSync 在接口中 Consumer<V>SQLException - jni exceptionpublic void close()
throws SQLException
Consumerclose 在接口中 Consumer<V>SQLException - jni exceptionpublic void releaseResultSet(long ptr)
throws SQLException
SQLExceptionpublic String getErrMsg(int code)
public void closeOffset(long prt)
Copyright © 2023. All rights reserved.