Class MockShareConsumer<K,V>
java.lang.Object
org.apache.kafka.clients.consumer.MockShareConsumer<K,V>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ShareConsumer<K,
V>
A mock of the
ShareConsumer
interface you can use for testing code that uses Kafka. This class is not
thread-safe .-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
acknowledge
(ConsumerRecord<K, V> record) void
acknowledge
(ConsumerRecord<K, V> record, AcknowledgeType type) void
addRecord
(ConsumerRecord<K, V> record) clientInstanceId
(Duration timeout) void
close()
void
void
commitSync
(Duration timeout) Map<MetricName,
? extends Metric> metrics()
void
void
setClientInstanceId
(Uuid clientInstanceId) void
subscribe
(Collection<String> topics) void
void
wakeup()
-
Constructor Details
-
MockShareConsumer
public MockShareConsumer()
-
-
Method Details
-
subscription
- Specified by:
subscription
in interfaceShareConsumer<K,
V> - See Also:
-
subscribe
- Specified by:
subscribe
in interfaceShareConsumer<K,
V> - See Also:
-
unsubscribe
public void unsubscribe()- Specified by:
unsubscribe
in interfaceShareConsumer<K,
V> - See Also:
-
poll
- Specified by:
poll
in interfaceShareConsumer<K,
V> - See Also:
-
acknowledge
- Specified by:
acknowledge
in interfaceShareConsumer<K,
V> - See Also:
-
acknowledge
- Specified by:
acknowledge
in interfaceShareConsumer<K,
V> - See Also:
-
commitSync
- Specified by:
commitSync
in interfaceShareConsumer<K,
V> - See Also:
-
commitSync
- Specified by:
commitSync
in interfaceShareConsumer<K,
V> - See Also:
-
commitAsync
public void commitAsync()- Specified by:
commitAsync
in interfaceShareConsumer<K,
V> - See Also:
-
setAcknowledgementCommitCallback
- Specified by:
setAcknowledgementCommitCallback
in interfaceShareConsumer<K,
V> - See Also:
-
setClientInstanceId
-
clientInstanceId
Description copied from interface:ShareConsumer
- Specified by:
clientInstanceId
in interfaceShareConsumer<K,
V>
-
metrics
- Specified by:
metrics
in interfaceShareConsumer<K,
V> - See Also:
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceShareConsumer<K,
V> - See Also:
-
close
- Specified by:
close
in interfaceShareConsumer<K,
V> - See Also:
-
wakeup
public void wakeup()- Specified by:
wakeup
in interfaceShareConsumer<K,
V> - See Also:
-
addRecord
-