Class ConsumerConfiguration

java.lang.Object
org.apache.pulsar.client.api.ConsumerConfiguration
All Implemented Interfaces:
Serializable

@Deprecated public class ConsumerConfiguration extends Object implements Serializable
Deprecated.
Use PulsarClient#newConsumer to build and configure a Consumer instance
Class specifying the configuration of a consumer. In Exclusive subscription, only a single consumer is allowed to attach to the subscription. Other consumers will get an error message. In Shared subscription, multiple consumers will be able to use the same subscription name and the messages will be dispatched in a round robin fashion.
See Also:
  • Constructor Details

    • ConsumerConfiguration

      public ConsumerConfiguration()
      Deprecated.
  • Method Details

    • getAckTimeoutMillis

      public long getAckTimeoutMillis()
      Deprecated.
      Returns:
      the configured timeout in milliseconds for unacked messages.
    • setAckTimeout

      public ConsumerConfiguration setAckTimeout(long ackTimeout, TimeUnit timeUnit)
      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

      public MessageListener<byte[]> getMessageListener()
      Deprecated.
      Returns:
      the configured MessageListener for the consumer
    • setMessageListener

      public ConsumerConfiguration setMessageListener(MessageListener<byte[]> messageListener)
      Deprecated.
      Sets a MessageListener for the consumer

      When a MessageListener is set, application will receive messages through it. Calls to Consumer.receive() will not be allowed.

      Parameters:
      messageListener - the listener object
    • getConsumerEventListener

      public org.apache.pulsar.client.api.ConsumerEventListener getConsumerEventListener()
      Deprecated.
      Returns:
      this configured ConsumerEventListener for the consumer.
      Since:
      2.0
      See Also:
    • setConsumerEventListener

      public ConsumerConfiguration setConsumerEventListener(org.apache.pulsar.client.api.ConsumerEventListener listener)
      Deprecated.
      Sets a ConsumerEventListener for 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 a CryptoKeyReader.
      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

      public ConsumerConfiguration setReceiverQueueSize(int receiverQueueSize)
      Deprecated.
      Sets the size of the consumer receive queue.

      The consumer receive queue controls how many messages can be accumulated by the Consumer before the application calls Consumer.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 while Consumer.receiveAsync() receives exception in callback. consumer will not be able receive any further message unless batch-message in pipeline is removed

      Default value is 1000 messages and should be good for most use cases.
      Parameters:
      receiverQueueSize - the new receiver queue size value
    • getConsumerName

      public String getConsumerName()
      Deprecated.
      Returns:
      the consumer name
    • setConsumerName

      public ConsumerConfiguration setConsumerName(String consumerName)
      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

      public ConsumerConfiguration 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. 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

      public ConsumerConfiguration setProperty(String key, String value)
      Deprecated.
      Set a name/value property with this consumer.
      Parameters:
      key -
      value -
      Returns:
    • setProperties

      public ConsumerConfiguration setProperties(Map<String,String> properties)
      Deprecated.
      Add all the properties in the provided map.
      Parameters:
      properties -
      Returns:
    • getProperties

      public Map<String,String> 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 subscriptionInitialPosition for the consumer
    • getNegativeAckRedeliveryBackoff

      public org.apache.pulsar.client.api.RedeliveryBackoff getNegativeAckRedeliveryBackoff()
      Deprecated.
      Returns:
      the configured RedeliveryBackoff for 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 RedeliveryBackoff for 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