public interface ProducerBuilder
Producer.| Modifier and Type | Interface and Description |
|---|---|
static interface |
ProducerBuilder.RoutingConfiguration
Routing configuration for super streams (partitioned streams).
|
| Modifier and Type | Method and Description |
|---|---|
ProducerBuilder |
batchPublishingDelay(Duration batchPublishingDelay)
Period to send a batch of messages.
|
ProducerBuilder |
batchSize(int batchSize)
The maximum number of messages to accumulate before sending them to the broker.
|
Producer |
build()
Create the
Producer instance. |
ProducerBuilder |
compression(Compression compression) |
ProducerBuilder |
confirmTimeout(Duration timeout)
Time before the client calls the confirm callback to signal outstanding unconfirmed messages
timed out.
|
ProducerBuilder |
enqueueTimeout(Duration timeout)
Time before enqueueing of a message fail when the maximum number of unconfirmed is reached.
|
ProducerBuilder |
maxUnconfirmedMessages(int maxUnconfirmedMessages)
The maximum number of unconfirmed outbound messages.
|
ProducerBuilder |
name(String name)
The logical name of the producer.
|
ProducerBuilder.RoutingConfiguration |
routing(Function<Message,String> routingKeyExtractor)
Configure the routing for super streams (partitioned streams).
|
ProducerBuilder |
stream(String stream)
The stream to send messages to.
|
ProducerBuilder |
subEntrySize(int subEntrySize)
The number of messages to put in a sub-entry of a publish frame.
|
ProducerBuilder name(String name)
Set a value to enable de-duplication.
name - ProducerBuilder stream(String stream)
stream - ProducerBuilder subEntrySize(int subEntrySize)
The default is 1 (no sub-entry batching).
subEntrySize - ProducerBuilder compression(Compression compression)
ProducerBuilder batchSize(int batchSize)
Default is 100.
batchSize - ProducerBuilder batchPublishingDelay(Duration batchPublishingDelay)
Default is 100 ms.
batchPublishingDelay - ProducerBuilder maxUnconfirmedMessages(int maxUnconfirmedMessages)
Producer.send(Message, ConfirmationHandler) will start blocking when the limit is
reached.
Default is 10,000.
maxUnconfirmedMessages - ProducerBuilder confirmTimeout(Duration timeout)
Default is 30 seconds.
timeout - ProducerBuilder enqueueTimeout(Duration timeout)
Default is 10 seconds.
Set the value to Duration.ZERO if there should be no timeout.
timeout - ProducerBuilder.RoutingConfiguration routing(Function<Message,String> routingKeyExtractor)
This is an experimental API, subject to change.
The to-be-created producer will be a composite producer when this method is called. It will use the routing configuration to find out where a message should be routed. The application developer must provide the logic to extract a "routing key" from a message, which will decide the destination(s) of the message.
The default routing strategy hashes the routing key to choose the stream (partition) to send the message to.
Note the routing key extraction logic is required only when the built-in routing strategies
are used. It can set to null when a custom RoutingStrategy is set with
routing(Function).
routingKeyExtractor - the logic to extract a routing key from a messageProducerBuilder.RoutingConfigurationCopyright © 2022 VMware, Inc. or its affiliates.. All rights reserved.