Uses of Interface
org.apache.pulsar.client.api.ConsumerBuilder
-
Uses of ConsumerBuilder in org.apache.pulsar.client.api
Modifier and TypeMethodDescriptionConsumerBuilder.acknowledgmentGroupTime
(long delay, TimeUnit unit) Group the consumer acknowledgments for the specified time.ConsumerBuilder.ackTimeout
(long ackTimeout, TimeUnit timeUnit) Set the timeout for unacked messages, truncated to the nearest millisecond.ConsumerBuilder.ackTimeoutRedeliveryBackoff
(RedeliveryBackoff ackTimeoutRedeliveryBackoff) Notice: the redeliveryBackoff doesn't work with `consumer.negativeAcknowledge(MessageId messageId)` because we are not able to get the redelivery count from the message ID.ConsumerBuilder.ackTimeoutTickTime
(long tickTime, TimeUnit timeUnit) Define the granularity of the ack-timeout redelivery.ConsumerBuilder.autoAckOldestChunkedMessageOnQueueFull
(boolean autoAckOldestChunkedMessageOnQueueFull) Buffering large number of outstanding uncompleted chunked messages can create memory pressure and it can be guarded by providing this @maxPendingChunkedMessage threshold.ConsumerBuilder.autoScaledReceiverQueueSizeEnabled
(boolean enabled) If this is enabled, consumer receiver queue size is init as a very small value, 1 by default, and it will double itself until it reaches the value set byreceiverQueueSize(int)
, if and only if 1) User calls receive() and there is no messages in receiver queue.ConsumerBuilder.autoUpdatePartitions
(boolean autoUpdate) If enabled, the consumer auto-subscribes for partitions increasement.ConsumerBuilder.autoUpdatePartitionsInterval
(int interval, TimeUnit unit) Set the interval of updating partitions (default: 1 minute).ConsumerBuilder.batchReceivePolicy
(BatchReceivePolicy batchReceivePolicy) Set batch receive policyBatchReceivePolicy
for consumer.TopicConsumerBuilder.build()
Complete the configuration of the topic specific options and return control back to theConsumerBuilder
instance.ConsumerBuilder.clone()
Create a copy of the current consumer builder.ConsumerBuilder.consumerEventListener
(ConsumerEventListener consumerEventListener) Sets aConsumerEventListener
for the consumer.ConsumerBuilder.consumerName
(String consumerName) Set the consumer name.ConsumerBuilder.cryptoFailureAction
(ConsumerCryptoFailureAction action) Sets the ConsumerCryptoFailureAction to the value specified.ConsumerBuilder.cryptoKeyReader
(CryptoKeyReader cryptoKeyReader) Sets aCryptoKeyReader
.ConsumerBuilder.deadLetterPolicy
(DeadLetterPolicy deadLetterPolicy) Set dead letter policy for consumer.ConsumerBuilder.defaultCryptoKeyReader
(String privateKey) Sets the default implementation ofCryptoKeyReader
.ConsumerBuilder.defaultCryptoKeyReader
(Map<String, String> privateKeys) Sets the default implementation ofCryptoKeyReader
.ConsumerBuilder.enableBatchIndexAcknowledgment
(boolean batchIndexAcknowledgmentEnabled) Enable or disable the batch index acknowledgment.ConsumerBuilder.enableRetry
(boolean retryEnable) If enabled, the consumer auto retries message.ConsumerBuilder.expireTimeOfIncompleteChunkedMessage
(long duration, TimeUnit unit) If producer fails to publish all the chunks of a message then consumer can expire incomplete chunks if consumer won't be able to receive all chunks in expire times (default 1 minute).ConsumerBuilder.intercept
(ConsumerInterceptor<T>... interceptors) InterceptConsumer
.ConsumerBuilder.isAckReceiptEnabled
(boolean isAckReceiptEnabled) Ack returns receipt but does not mean that the message is not resent after get receipt.ConsumerBuilder.keySharedPolicy
(KeySharedPolicy keySharedPolicy) Set KeyShared subscription policy for consumer.Load the configuration from provided config map.ConsumerBuilder.maxPendingChuckedMessage
(int maxPendingChuckedMessage) Deprecated.ConsumerBuilder.maxPendingChunkedMessage
(int maxPendingChunkedMessage) Consumer buffers chunk messages into memory until it receives all the chunks of the original message.ConsumerBuilder.maxTotalReceiverQueueSizeAcrossPartitions
(int maxTotalReceiverQueueSizeAcrossPartitions) Set the max total receiver queue size across partitons.ConsumerBuilder.messageCrypto
(MessageCrypto messageCrypto) Sets aMessageCrypto
.ConsumerBuilder.messageListener
(MessageListener<T> messageListener) Sets aMessageListener
for the consumerConsumerBuilder.messagePayloadProcessor
(MessagePayloadProcessor payloadProcessor) If it's configured with a non-null value, the consumer uses the processor to process the payload, including decoding it to messages and triggering the listener.ConsumerBuilder.negativeAckRedeliveryBackoff
(RedeliveryBackoff negativeAckRedeliveryBackoff) Notice: the negativeAckRedeliveryBackoff doesn't work with `consumer.negativeAcknowledge(MessageId messageId)` because we are not able to get the redelivery count from the message ID.ConsumerBuilder.negativeAckRedeliveryDelay
(long redeliveryDelay, TimeUnit timeUnit) Set the delay to wait before re-delivering messages that have failed to be process.ConsumerBuilder<byte[]>
PulsarClient.newConsumer()
Create a consumer builder with no schema (Schema.BYTES
) for subscribing to one or more topics.<T> ConsumerBuilder<T>
PulsarClient.newConsumer
(Schema<T> schema) Create a consumer builder with a specific schema for subscribing on a specific topicConsumerBuilder.patternAutoDiscoveryPeriod
(int periodInMinutes) Set topics auto discovery period when using a pattern for topics consumer.ConsumerBuilder.patternAutoDiscoveryPeriod
(int interval, TimeUnit unit) Set topics auto discovery period when using a pattern for topics consumer.ConsumerBuilder.poolMessages
(boolean poolMessages) Enable pooling of messages and the underlying data buffers.ConsumerBuilder.priorityLevel
(int priorityLevel) Shared subscription Sets priority level for the shared subscription consumers to which broker gives more priority while dispatching messages.ConsumerBuilder.properties
(Map<String, String> properties) Add all the properties in the provided map to the consumer.Set a name/value property with this consumer.ConsumerBuilder.readCompacted
(boolean readCompacted) If enabled, the consumer reads messages from the compacted topic rather than reading the full message backlog of the topic.ConsumerBuilder.receiverQueueSize
(int receiverQueueSize) Sets the size of the consumer receive queue.ConsumerBuilder.replicateSubscriptionState
(boolean replicateSubscriptionState) ConsumerBuilder.startMessageIdInclusive()
Set the consumer to include the given position of any reset operation likeor Consumer#seek(MessageId)
.ConsumerBuilder.startPaused
(boolean paused) Start the consumer in a paused state.ConsumerBuilder.subscriptionInitialPosition
(SubscriptionInitialPosition subscriptionInitialPosition) Set theSubscriptionInitialPosition
for the consumer.ConsumerBuilder.subscriptionMode
(SubscriptionMode subscriptionMode) Select the subscription mode to be used when subscribing to the topic.ConsumerBuilder.subscriptionName
(String subscriptionName) Specify the subscription name for this consumer.ConsumerBuilder.subscriptionProperties
(Map<String, String> subscriptionProperties) Specify the subscription properties for this subscription.ConsumerBuilder.subscriptionTopicsMode
(RegexSubscriptionMode regexSubscriptionMode) Determines to which topics this consumer should be subscribed to - Persistent, Non-Persistent, or both.ConsumerBuilder.subscriptionType
(SubscriptionType subscriptionType) Select the subscription type to be used when subscribing to the topic.Specify the topics this consumer subscribes on.ConsumerBuilder.topicConfiguration
(String topicName, Consumer<TopicConsumerBuilder<T>> builderConsumer) Configure topic specific options to override those set at theConsumerBuilder
level.ConsumerBuilder.topicConfiguration
(Pattern topicsPattern, Consumer<TopicConsumerBuilder<T>> builderConsumer) Configure topic specific options to override those set at theConsumerBuilder
level.Specify a list of topics that this consumer subscribes on.ConsumerBuilder.topicsPattern
(String topicsPattern) Specify a pattern for topics that this consumer subscribes on.ConsumerBuilder.topicsPattern
(Pattern topicsPattern) Specify a pattern for topics that this consumer subscribes on.
maxPendingChunkedMessage(int)