Class ConsumerConfiguration
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongDeprecated.org.apache.pulsar.client.api.RedeliveryBackoffDeprecated.org.apache.pulsar.client.impl.conf.ConsumerConfigurationData<byte[]>Deprecated.org.apache.pulsar.client.api.ConsumerEventListenerDeprecated.Deprecated.org.apache.pulsar.client.api.ConsumerCryptoFailureActionDeprecated.org.apache.pulsar.client.api.CryptoKeyReaderDeprecated.intDeprecated.MessageListener<byte[]>Deprecated.org.apache.pulsar.client.api.RedeliveryBackoffDeprecated.intDeprecated.Deprecated.booleanDeprecated.intDeprecated.org.apache.pulsar.client.api.SubscriptionInitialPositionDeprecated.org.apache.pulsar.client.api.SubscriptionTypeDeprecated.setAckTimeout(long ackTimeout, TimeUnit timeUnit) Deprecated.Set the timeout for unacked messages, truncated to the nearest millisecond.setAckTimeoutRedeliveryBackoff(org.apache.pulsar.client.api.RedeliveryBackoff ackTimeoutRedeliveryBackoff) Deprecated.setConsumerEventListener(org.apache.pulsar.client.api.ConsumerEventListener listener) Deprecated.Sets aConsumerEventListenerfor the consumer.setConsumerName(String consumerName) Deprecated.Set the consumer name.voidsetCryptoFailureAction(org.apache.pulsar.client.api.ConsumerCryptoFailureAction action) Deprecated.Sets the ConsumerCryptoFailureAction to the value specified.setCryptoKeyReader(org.apache.pulsar.client.api.CryptoKeyReader cryptoKeyReader) Deprecated.Sets aCryptoKeyReader.voidsetMaxTotalReceiverQueueSizeAcrossPartitions(int maxTotalReceiverQueueSizeAcrossPartitions) Deprecated.Set the max total receiver queue size across partitons.setMessageListener(MessageListener<byte[]> messageListener) Deprecated.Sets aMessageListenerfor the consumersetNegativeAckRedeliveryBackoff(org.apache.pulsar.client.api.RedeliveryBackoff negativeAckRedeliveryBackoff) Deprecated.voidsetPriorityLevel(int priorityLevel) Deprecated.Sets priority level for the shared subscription consumers to which broker gives more priority while dispatching messages.setProperties(Map<String, String> properties) Deprecated.Add all the properties in the provided map.setProperty(String key, String value) Deprecated.Set a name/value property with this consumer.setReadCompacted(boolean readCompacted) Deprecated.If enabled, the consumer will read messages from the compacted topic rather than reading the full message backlog of the topic.setReceiverQueueSize(int receiverQueueSize) Deprecated.Sets the size of the consumer receive queue.setSubscriptionInitialPosition(org.apache.pulsar.client.api.SubscriptionInitialPosition subscriptionInitialPosition) Deprecated.setSubscriptionType(org.apache.pulsar.client.api.SubscriptionType subscriptionType) Deprecated.Select the subscription type to be used when subscribing to the topic.
-
Constructor Details
-
ConsumerConfiguration
public ConsumerConfiguration()Deprecated.
-
-
Method Details
-
getAckTimeoutMillis
public long getAckTimeoutMillis()Deprecated.- Returns:
- the configured timeout in milliseconds for unacked messages.
-
setAckTimeout
Deprecated.Set the timeout for unacked messages, truncated to the nearest millisecond. The timeout needs to be greater than 10 seconds.- Parameters:
ackTimeout- for unacked messages.timeUnit- unit in which the timeout is provided.- Returns:
ConsumerConfiguration
-
getSubscriptionType
public org.apache.pulsar.client.api.SubscriptionType getSubscriptionType()Deprecated.- Returns:
- the configured subscription type
-
setSubscriptionType
public ConsumerConfiguration setSubscriptionType(org.apache.pulsar.client.api.SubscriptionType subscriptionType) Deprecated.Select the subscription type to be used when subscribing to the topic.Default is
SubscriptionType.Exclusive- Parameters:
subscriptionType- the subscription type value
-
getMessageListener
Deprecated.- Returns:
- the configured
MessageListenerfor the consumer
-
setMessageListener
Deprecated.Sets aMessageListenerfor the consumerWhen a
MessageListeneris set, application will receive messages through it. Calls toConsumer.receive()will not be allowed.- Parameters:
messageListener- the listener object
-
getConsumerEventListener
public org.apache.pulsar.client.api.ConsumerEventListener getConsumerEventListener()Deprecated.- Returns:
- this configured
ConsumerEventListenerfor the consumer. - Since:
- 2.0
- See Also:
-
setConsumerEventListener
public ConsumerConfiguration setConsumerEventListener(org.apache.pulsar.client.api.ConsumerEventListener listener) Deprecated.Sets aConsumerEventListenerfor the consumer.The consumer group listener is used for receiving consumer state change in a consumer group for failover subscription. Application can then react to the consumer state changes.
This change is experimental. It is subject to changes coming in release 2.0.
- Parameters:
listener- the consumer group listener object- Returns:
- consumer configuration
- Since:
- 2.0
-
getReceiverQueueSize
public int getReceiverQueueSize()Deprecated.- Returns:
- the configure receiver queue size value
-
getMaxTotalReceiverQueueSizeAcrossPartitions
public int getMaxTotalReceiverQueueSizeAcrossPartitions()Deprecated.- Returns:
- the configured max total receiver queue size across partitions
-
setMaxTotalReceiverQueueSizeAcrossPartitions
public void setMaxTotalReceiverQueueSizeAcrossPartitions(int maxTotalReceiverQueueSizeAcrossPartitions) Deprecated.Set the max total receiver queue size across partitons.This setting will be used to reduce the receiver queue size for individual partitions
setReceiverQueueSize(int)if the total exceeds this value (default: 50000).- Parameters:
maxTotalReceiverQueueSizeAcrossPartitions-
-
getCryptoKeyReader
public org.apache.pulsar.client.api.CryptoKeyReader getCryptoKeyReader()Deprecated.- Returns:
- the CryptoKeyReader
-
setCryptoKeyReader
public ConsumerConfiguration setCryptoKeyReader(org.apache.pulsar.client.api.CryptoKeyReader cryptoKeyReader) Deprecated.Sets aCryptoKeyReader.- Parameters:
cryptoKeyReader- CryptoKeyReader object
-
setCryptoFailureAction
public void setCryptoFailureAction(org.apache.pulsar.client.api.ConsumerCryptoFailureAction action) Deprecated.Sets the ConsumerCryptoFailureAction to the value specified.- Parameters:
action- consumer action
-
getCryptoFailureAction
public org.apache.pulsar.client.api.ConsumerCryptoFailureAction getCryptoFailureAction()Deprecated.- Returns:
- The ConsumerCryptoFailureAction
-
setReceiverQueueSize
Deprecated.Sets the size of the consumer receive queue.The consumer receive queue controls how many messages can be accumulated by the
Consumerbefore the application callsConsumer.receive(). Using a higher value could potentially increase the consumer throughput at the expense of bigger memory utilization.Setting the consumer queue size as zero
- Decreases the throughput of the consumer, by disabling pre-fetching of messages. This approach improves the
message distribution on shared subscription, by pushing messages only to the consumers that are ready to process
them. Neither
Consumer.receive(int, TimeUnit)nor Partitioned Topics can be used if the consumer queue size is zero.Consumer.receive()function call should not be interrupted when the consumer queue size is zero. - Doesn't support Batch-Message: if consumer receives any batch-message then it closes consumer connection with
broker and
Consumer.receive()call will remain blocked whileConsumer.receiveAsync()receives exception in callback. consumer will not be able receive any further message unless batch-message in pipeline is removed
1000messages and should be good for most use cases.- Parameters:
receiverQueueSize- the new receiver queue size value
- Decreases the throughput of the consumer, by disabling pre-fetching of messages. This approach improves the
message distribution on shared subscription, by pushing messages only to the consumers that are ready to process
them. Neither
-
getConsumerName
Deprecated.- Returns:
- the consumer name
-
setConsumerName
Deprecated.Set the consumer name.- Parameters:
consumerName-
-
getPriorityLevel
public int getPriorityLevel()Deprecated. -
setPriorityLevel
public void setPriorityLevel(int priorityLevel) Deprecated.Sets priority level for the shared subscription consumers to which broker gives more priority while dispatching messages. Here, broker follows descending priorities. (eg: 0=max-priority, 1, 2,..)
In Shared subscription mode, broker will first dispatch messages to max priority-level consumers if they have permits, else broker will consider next priority level consumers.
If subscription has consumer-A with priorityLevel 0 and Consumer-B with priorityLevel 1 then broker will dispatch messages to only consumer-A until it runs out permit and then broker starts dispatching messages to Consumer-B.Consumer PriorityLevel Permits C1 0 2 C2 0 1 C3 0 1 C4 1 2 C5 1 1 Order in which broker dispatches messages to consumers: C1, C2, C3, C1, C4, C5, C4
- Parameters:
priorityLevel-
-
getReadCompacted
public boolean getReadCompacted()Deprecated. -
setReadCompacted
Deprecated.If enabled, the consumer will read messages from the compacted topic rather than reading the full message backlog of the topic. This means that, if the topic has been compacted, the consumer will only see the latest value for each key in the topic, up until the point in the topic message backlog that has been compacted. Beyond that point, the messages will be sent as normal. readCompacted can only be enabled subscriptions to persistent topics, which have a single active consumer (i.e. failure or exclusive subscriptions). Attempting to enable it on subscriptions to a non-persistent topics or on a shared subscription, will lead to the subscription call throwing a PulsarClientException.- Parameters:
readCompacted- whether to read from the compacted topic
-
setProperty
Deprecated.Set a name/value property with this consumer.- Parameters:
key-value-- Returns:
-
setProperties
Deprecated.Add all the properties in the provided map.- Parameters:
properties-- Returns:
-
getProperties
Deprecated. -
getConfigurationData
public org.apache.pulsar.client.impl.conf.ConsumerConfigurationData<byte[]> getConfigurationData()Deprecated. -
setSubscriptionInitialPosition
public ConsumerConfiguration setSubscriptionInitialPosition(org.apache.pulsar.client.api.SubscriptionInitialPosition subscriptionInitialPosition) Deprecated.- Parameters:
subscriptionInitialPosition- the initial position at which to set set cursor when subscribing to the topic first time Default is
-
getSubscriptionInitialPosition
public org.apache.pulsar.client.api.SubscriptionInitialPosition getSubscriptionInitialPosition()Deprecated.- Returns:
- the configured
subscriptionInitialPositionfor the consumer
-
getNegativeAckRedeliveryBackoff
public org.apache.pulsar.client.api.RedeliveryBackoff getNegativeAckRedeliveryBackoff()Deprecated.- Returns:
- the configured
RedeliveryBackofffor the consumer
-
setNegativeAckRedeliveryBackoff
public ConsumerConfiguration setNegativeAckRedeliveryBackoff(org.apache.pulsar.client.api.RedeliveryBackoff negativeAckRedeliveryBackoff) Deprecated.- Parameters:
negativeAckRedeliveryBackoff- the negative ack redelivery backoff policy. Default value is: MultiplierRedeliveryBackoff- Returns:
- the
ConsumerConfiguration
-
getAckTimeoutRedeliveryBackoff
public org.apache.pulsar.client.api.RedeliveryBackoff getAckTimeoutRedeliveryBackoff()Deprecated.- Returns:
- the configured
RedeliveryBackofffor the consumer
-
setAckTimeoutRedeliveryBackoff
public ConsumerConfiguration setAckTimeoutRedeliveryBackoff(org.apache.pulsar.client.api.RedeliveryBackoff ackTimeoutRedeliveryBackoff) Deprecated.- Parameters:
ackTimeoutRedeliveryBackoff- redelivery backoff policy for ack timeout. Default value is: MultiplierRedeliveryBackoff- Returns:
- the
ConsumerConfiguration
-
PulsarClient#newConsumerto build and configure aConsumerinstance