public class MockShareConsumer<K,V> extends Object implements ShareConsumer<K,V>
ShareConsumer interface you can use for testing code that uses Kafka. This class is not
thread-safe .| Constructor and Description |
|---|
MockShareConsumer() |
| Modifier and Type | Method and Description |
|---|---|
void |
acknowledge(ConsumerRecord<K,V> record) |
void |
acknowledge(ConsumerRecord<K,V> record,
AcknowledgeType type) |
void |
addRecord(ConsumerRecord<K,V> record) |
Uuid |
clientInstanceId(Duration timeout)
|
void |
close() |
void |
close(Duration timeout) |
void |
commitAsync() |
Map<TopicIdPartition,Optional<KafkaException>> |
commitSync() |
Map<TopicIdPartition,Optional<KafkaException>> |
commitSync(Duration timeout) |
Map<MetricName,? extends Metric> |
metrics() |
ConsumerRecords<K,V> |
poll(Duration timeout) |
void |
setAcknowledgementCommitCallback(AcknowledgementCommitCallback callback) |
void |
setClientInstanceId(Uuid clientInstanceId) |
void |
subscribe(Collection<String> topics) |
Set<String> |
subscription() |
void |
unsubscribe() |
void |
wakeup() |
public Set<String> subscription()
subscription in interface ShareConsumer<K,V>KafkaShareConsumer.subscription()public void subscribe(Collection<String> topics)
subscribe in interface ShareConsumer<K,V>KafkaShareConsumer.subscribe(Collection)public void unsubscribe()
unsubscribe in interface ShareConsumer<K,V>KafkaShareConsumer.unsubscribe()public ConsumerRecords<K,V> poll(Duration timeout)
poll in interface ShareConsumer<K,V>KafkaShareConsumer.poll(Duration)public void acknowledge(ConsumerRecord<K,V> record)
acknowledge in interface ShareConsumer<K,V>KafkaShareConsumer.acknowledge(ConsumerRecord)public void acknowledge(ConsumerRecord<K,V> record, AcknowledgeType type)
acknowledge in interface ShareConsumer<K,V>KafkaShareConsumer.acknowledge(ConsumerRecord, AcknowledgeType)public Map<TopicIdPartition,Optional<KafkaException>> commitSync()
commitSync in interface ShareConsumer<K,V>KafkaShareConsumer.commitSync()public Map<TopicIdPartition,Optional<KafkaException>> commitSync(Duration timeout)
commitSync in interface ShareConsumer<K,V>KafkaShareConsumer.commitSync(Duration)public void commitAsync()
commitAsync in interface ShareConsumer<K,V>KafkaShareConsumer.commitAsync()public void setAcknowledgementCommitCallback(AcknowledgementCommitCallback callback)
setAcknowledgementCommitCallback in interface ShareConsumer<K,V>KafkaShareConsumer.setAcknowledgementCommitCallback(AcknowledgementCommitCallback)public void setClientInstanceId(Uuid clientInstanceId)
public Uuid clientInstanceId(Duration timeout)
ShareConsumerclientInstanceId in interface ShareConsumer<K,V>public Map<MetricName,? extends Metric> metrics()
metrics in interface ShareConsumer<K,V>KafkaShareConsumer.metrics()public void close()
close in interface Closeableclose in interface AutoCloseableclose in interface ShareConsumer<K,V>KafkaShareConsumer.close()public void close(Duration timeout)
close in interface ShareConsumer<K,V>KafkaShareConsumer.close(Duration)public void wakeup()
wakeup in interface ShareConsumer<K,V>KafkaShareConsumer.wakeup()public void addRecord(ConsumerRecord<K,V> record)