Class MockInMemoryProducerAdapter
java.lang.Object
com.linkedin.venice.pubsub.mock.adapter.producer.MockInMemoryProducerAdapter
- All Implemented Interfaces:
PubSubProducerAdapter
A
PubSubProducerAdapter implementation which interacts with the
InMemoryPubSubBroker in order to make unit tests more lightweight.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(long closeTimeOutMs) voidflush()it.unimi.dsi.fastutil.objects.Object2DoubleMap<String>intgetNumberOfPartitions(String topic) The support for the following two getNumberOfPartitions APIs will be removed.static InMemoryPubSubPositiongetPosition(Future<PubSubProduceResult> produceResultFuture) sendMessage(String topic, Integer partition, KafkaKey key, KafkaMessageEnvelope value, PubSubMessageHeaders headers, PubSubProducerCallback callback) Sends a message to a PubSub topic asynchronously and returns aFuturerepresenting the result of the produce operation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.venice.pubsub.api.PubSubProducerAdapter
sendMessage
-
Constructor Details
-
MockInMemoryProducerAdapter
-
-
Method Details
-
getNumberOfPartitions
Description copied from interface:PubSubProducerAdapterThe support for the following two getNumberOfPartitions APIs will be removed.- Specified by:
getNumberOfPartitionsin interfacePubSubProducerAdapter
-
sendMessage
public CompletableFuture<PubSubProduceResult> sendMessage(String topic, Integer partition, KafkaKey key, KafkaMessageEnvelope value, PubSubMessageHeaders headers, PubSubProducerCallback callback) Description copied from interface:PubSubProducerAdapterSends a message to a PubSub topic asynchronously and returns aFuturerepresenting the result of the produce operation.- Specified by:
sendMessagein 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
Futurerepresenting the result of the produce operation.
-
flush
public void flush()- Specified by:
flushin interfacePubSubProducerAdapter
-
close
public void close(long closeTimeOutMs) - Specified by:
closein interfacePubSubProducerAdapter
-
getMeasurableProducerMetrics
- Specified by:
getMeasurableProducerMetricsin interfacePubSubProducerAdapter
-
getBrokerAddress
- Specified by:
getBrokerAddressin interfacePubSubProducerAdapter
-
getPosition
public static InMemoryPubSubPosition getPosition(Future<PubSubProduceResult> produceResultFuture) throws ExecutionException, InterruptedException
-