接口的使用
org.apache.pulsar.client.api.ConsumerBuilder
使用ConsumerBuilder的程序包
-
org.apache.pulsar.client.api中ConsumerBuilder的使用
修饰符和类型方法说明ConsumerBuilder.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 will not 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.autoUpdatePartitions(boolean autoUpdate) If enabled, the consumer will auto subscribe 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 policyBatchReceivePolicyfor consumer.ConsumerBuilder.clone()Create a copy of the current consumer builder.ConsumerBuilder.consumerEventListener(ConsumerEventListener consumerEventListener) Sets aConsumerEventListenerfor 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 will auto retry 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 will return receipt but does not mean that the message will not be 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) 已过时。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 aMessageListenerfor the consumerConsumerBuilder.messagePayloadProcessor(MessagePayloadProcessor payloadProcessor) If it's configured with a non-null value, the consumer will use the processor to process the payload, including decoding it to messages and triggering the listener.ConsumerBuilder.negativeAckRedeliveryBackoff(RedeliveryBackoff negativeAckRedeliveryBackoff) Notice: the negativeAckRedeliveryBackoff will not 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 will read 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 theSubscriptionInitialPositionfor 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 will subscribe on.Specify a list of topics that this consumer will subscribe on.ConsumerBuilder.topicsPattern(String topicsPattern) Specify a pattern for topics that this consumer will subscribe on.ConsumerBuilder.topicsPattern(Pattern topicsPattern) Specify a pattern for topics that this consumer will subscribe on.
maxPendingChunkedMessage(int)