Package com.linkedin.venice.pubsub.api
Interface PubSubProducerAdapter
- All Known Implementing Classes:
ApacheKafkaProducerAdapter
,MockInMemoryProducerAdapter
,PubSubProducerAdapterConcurrentDelegator
,PubSubProducerAdapterDelegator
,TransformingProducerAdapter
public interface PubSubProducerAdapter
The pub-sub producer interface with which venice writer's interact to send messages to pub-sub topic.
An implementation of this interface are required to provide the following guarantees:
1. At-least once delivery (ALOD): messages should not be dropped.
2. In order delivery (IOD): messages in the same partition should follow the order in which they were sent.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close
(long closeTimeOutMs) void
flush()
it.unimi.dsi.fastutil.objects.Object2DoubleMap<String>
int
getNumberOfPartitions
(String topic) Deprecated.sendMessage
(String topic, Integer partition, KafkaKey key, KafkaMessageEnvelope value, PubSubMessageHeaders pubSubMessageHeaders, PubSubProducerCallback pubSubProducerCallback) Sends a message to a PubSub topic asynchronously and returns aFuture
representing the result of the produce operation.
-
Method Details
-
getNumberOfPartitions
Deprecated.The support for the following two getNumberOfPartitions APIs will be removed. -
sendMessage
CompletableFuture<PubSubProduceResult> sendMessage(String topic, Integer partition, KafkaKey key, KafkaMessageEnvelope value, PubSubMessageHeaders pubSubMessageHeaders, PubSubProducerCallback pubSubProducerCallback) Sends a message to a PubSub topic asynchronously and returns aFuture
representing the result of the produce operation.- 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.pubSubMessageHeaders
- Additional headers to be included with the message.pubSubProducerCallback
- An optional callback to handle the result of the produce operation.- Returns:
- A
Future
representing the result of the produce operation. - Throws:
PubSubOpTimeoutException
- If the produce operation times out.PubSubTopicAuthorizationException
- If there's an authorization error while producing the message.PubSubTopicDoesNotExistException
- If the target topic does not exist.PubSubClientRetriableException
- If a retriable error occurs while producing the message.PubSubClientException
- If an error occurs while producing the message.
-
flush
void flush() -
close
void close(long closeTimeOutMs) -
getMeasurableProducerMetrics
it.unimi.dsi.fastutil.objects.Object2DoubleMap<String> getMeasurableProducerMetrics() -
getBrokerAddress
String getBrokerAddress()
-