Class MockInMemoryTransformingProducerAdapter
java.lang.Object
com.linkedin.venice.pubsub.mock.adapter.producer.MockInMemoryTransformingProducerAdapter
- All Implemented Interfaces:
- PubSubProducerAdapter
public class MockInMemoryTransformingProducerAdapter
extends Object
implements PubSubProducerAdapter
This 
PubSubProducerAdapter implementation allows tests to perform
 arbitrary transformations on the messages that are about to be written to
 PubSub.
 This can be used in unit tests to inject corrupt data.- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classstatic interface
- 
Constructor SummaryConstructorsConstructorDescriptionMockInMemoryTransformingProducerAdapter(PubSubProducerAdapter baseProducer, MockInMemoryTransformingProducerAdapter.SendMessageParametersTransformer transformer) 
- 
Method SummaryModifier 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.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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.venice.pubsub.api.PubSubProducerAdaptersendMessage
- 
Constructor Details- 
MockInMemoryTransformingProducerAdapterpublic MockInMemoryTransformingProducerAdapter(PubSubProducerAdapter baseProducer, MockInMemoryTransformingProducerAdapter.SendMessageParametersTransformer transformer) 
 
- 
- 
Method Details- 
getNumberOfPartitionsDescription copied from interface:PubSubProducerAdapterThe support for the following two getNumberOfPartitions APIs will be removed.- Specified by:
- getNumberOfPartitionsin interface- PubSubProducerAdapter
 
- 
sendMessagepublic 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 interface- PubSubProducerAdapter
- 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.
 
- 
flushpublic void flush()- Specified by:
- flushin interface- PubSubProducerAdapter
 
- 
closepublic void close(long closeTimeOutMs) - Specified by:
- closein interface- PubSubProducerAdapter
 
- 
getMeasurableProducerMetrics- Specified by:
- getMeasurableProducerMetricsin interface- PubSubProducerAdapter
 
- 
getBrokerAddress- Specified by:
- getBrokerAddressin interface- PubSubProducerAdapter
 
 
-