Interface KafkaConnection
public interface KafkaConnection
Used to send messages to a Kafka connection.
-
Method Summary
Modifier and TypeMethodDescriptionpublishToTopicAsync(String topic, String id, byte[] message) Publish a message to a Kafka broker configured through an ActiveCaching connector with a default timeout of 5 seconds.publishToTopicAsync(String topic, String id, byte[] message, Duration timeout) Publish a message to a Kafka broker configured through an ActiveCaching connector with a configured timeout.
-
Method Details
-
publishToTopicAsync
Publish a message to a Kafka broker configured through an ActiveCaching connector with a default timeout of 5 seconds.- Parameters:
topic- the topic to publish the message to.id- the ID (kafka Key) of the message.message- the message to publish.- Returns:
- a
CompletableFutureof typeVoidthat will complete when the message has been delivered to the kafka connector. If the message cannot be delivered,CompletableFuture.completeExceptionally(Throwable)will be called with the reason.
-
publishToTopicAsync
CompletableFuture<Void> publishToTopicAsync(String topic, String id, byte[] message, Duration timeout) Publish a message to a Kafka broker configured through an ActiveCaching connector with a configured timeout.- Parameters:
topic- the topic to publish the message to.id- the ID (kafka Key) of the message.message- the message to publish.timeout- the timeout.- Returns:
- a
CompletableFutureof typeVoidthat will complete when the message has been delivered to the kafka connector. If the message cannot be delivered,CompletableFuture.completeExceptionally(Throwable)will be called with the reason.
-