Class MockInMemoryProducerAdapter
java.lang.Object
com.linkedin.venice.unit.kafka.producer.MockInMemoryProducerAdapter
- All Implemented Interfaces:
PubSubProducerAdapter
A
PubSubProducerAdapter
implementation which interacts with the
InMemoryKafkaBroker
in order to make unit tests more lightweight.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close
(long closeTimeOutMs) void
flush()
it.unimi.dsi.fastutil.objects.Object2DoubleMap<String>
int
getNumberOfPartitions
(String topic) The support for the following two getNumberOfPartitions APIs will be removed.sendMessage
(String topic, Integer partition, KafkaKey key, KafkaMessageEnvelope value, PubSubMessageHeaders headers, PubSubProducerCallback callback) Sends a message to a PubSub topic asynchronously and returns aFuture
representing the result of the produce operation.
-
Constructor Details
-
MockInMemoryProducerAdapter
-
-
Method Details
-
getNumberOfPartitions
Description copied from interface:PubSubProducerAdapter
The support for the following two getNumberOfPartitions APIs will be removed.- Specified by:
getNumberOfPartitions
in interfacePubSubProducerAdapter
-
sendMessage
public CompletableFuture<PubSubProduceResult> sendMessage(String topic, Integer partition, KafkaKey key, KafkaMessageEnvelope value, PubSubMessageHeaders headers, PubSubProducerCallback callback) Description copied from interface:PubSubProducerAdapter
Sends a message to a PubSub topic asynchronously and returns aFuture
representing the result of the produce operation.- Specified by:
sendMessage
in interfacePubSubProducerAdapter
- Parameters:
topic
- The name of the Kafka topic to which the message will be sent.partition
- The partition to which the message should be sent.key
- The key associated with the message, used for partitioning and message retrieval.value
- The message payload to be sent to the PubSubTopic topic.headers
- Additional headers to be included with the message.callback
- An optional callback to handle the result of the produce operation.- Returns:
- A
Future
representing the result of the produce operation.
-
flush
public void flush()- Specified by:
flush
in interfacePubSubProducerAdapter
-
close
public void close(long closeTimeOutMs) - Specified by:
close
in interfacePubSubProducerAdapter
-
getMeasurableProducerMetrics
- Specified by:
getMeasurableProducerMetrics
in interfacePubSubProducerAdapter
-
getBrokerAddress
- Specified by:
getBrokerAddress
in interfacePubSubProducerAdapter
-