Interface AsyncProducer<T>
- Type Parameters:
T- the type of message values this producer sends
public interface AsyncProducer<T>
Asynchronous view of a
Producer.
All operations return CompletableFuture and never block.
Obtained via Producer.async().
-
Method Details
-
newMessage
AsyncMessageBuilder<T> newMessage()Create a message builder for advanced message construction. UseAsyncMessageBuilder.send()as the terminal operation.- Returns:
- a new
AsyncMessageBuilderfor configuring and sending a message
-
flush
CompletableFuture<Void> flush()Flush all pending messages asynchronously.- Returns:
- a
CompletableFuturethat completes when all pending messages have been flushed to the broker
-
close
CompletableFuture<Void> close()Close this producer asynchronously.- Returns:
- a
CompletableFuturethat completes when the producer has been closed and all resources have been released
-