PulsarClient.newConsumer()
to build and configure a Consumer
instance@Deprecated
public class ConsumerConfiguration
extends Object
implements Serializable
Constructor and Description |
---|
ConsumerConfiguration()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
long |
getAckTimeoutMillis()
Deprecated.
|
<any> |
getConfigurationData()
Deprecated.
|
ConsumerEventListener |
getConsumerEventListener()
Deprecated.
|
String |
getConsumerName()
Deprecated.
|
ConsumerCryptoFailureAction |
getCryptoFailureAction()
Deprecated.
|
CryptoKeyReader |
getCryptoKeyReader()
Deprecated.
|
int |
getMaxTotalReceiverQueueSizeAcrossPartitions()
Deprecated.
|
MessageListener<byte[]> |
getMessageListener()
Deprecated.
|
int |
getPriorityLevel()
Deprecated.
|
Map<String,String> |
getProperties()
Deprecated.
|
boolean |
getReadCompacted()
Deprecated.
|
int |
getReceiverQueueSize()
Deprecated.
|
SubscriptionInitialPosition |
getSubscriptionInitialPosition()
Deprecated.
|
SubscriptionType |
getSubscriptionType()
Deprecated.
|
long |
getTickDurationMillis()
Deprecated.
|
ConsumerConfiguration |
setAckTimeout(long ackTimeout,
TimeUnit timeUnit)
Deprecated.
Set the timeout for unacked messages, truncated to the nearest millisecond.
|
ConsumerConfiguration |
setConsumerEventListener(ConsumerEventListener listener)
Deprecated.
Sets a
ConsumerEventListener for the consumer. |
ConsumerConfiguration |
setConsumerName(String consumerName)
Deprecated.
Set the consumer name.
|
void |
setCryptoFailureAction(ConsumerCryptoFailureAction action)
Deprecated.
Sets the ConsumerCryptoFailureAction to the value specified
|
ConsumerConfiguration |
setCryptoKeyReader(CryptoKeyReader cryptoKeyReader)
Deprecated.
Sets a
CryptoKeyReader |
void |
setMaxTotalReceiverQueueSizeAcrossPartitions(int maxTotalReceiverQueueSizeAcrossPartitions)
Deprecated.
Set the max total receiver queue size across partitons.
|
ConsumerConfiguration |
setMessageListener(MessageListener<byte[]> messageListener)
Deprecated.
Sets a
MessageListener for the consumer |
void |
setPriorityLevel(int priorityLevel)
Deprecated.
Sets priority level for the shared subscription consumers to which broker gives more priority while dispatching
messages.
|
ConsumerConfiguration |
setProperties(Map<String,String> properties)
Deprecated.
Add all the properties in the provided map
|
ConsumerConfiguration |
setProperty(String key,
String value)
Deprecated.
Set a name/value property with this consumer.
|
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.
|
ConsumerConfiguration |
setReceiverQueueSize(int receiverQueueSize)
Deprecated.
Sets the size of the consumer receive queue.
|
ConsumerConfiguration |
setSubscriptionInitialPosition(SubscriptionInitialPosition subscriptionInitialPosition)
Deprecated.
|
ConsumerConfiguration |
setSubscriptionType(SubscriptionType subscriptionType)
Deprecated.
Select the subscription type to be used when subscribing to the topic.
|
public long getAckTimeoutMillis()
public long getTickDurationMillis()
public ConsumerConfiguration setAckTimeout(long ackTimeout, TimeUnit timeUnit)
ackTimeout
- for unacked messages.timeUnit
- unit in which the timeout is provided.ConsumerConfiguration
public SubscriptionType getSubscriptionType()
public ConsumerConfiguration setSubscriptionType(SubscriptionType subscriptionType)
Default is SubscriptionType.Exclusive
subscriptionType
- the subscription type valuepublic MessageListener<byte[]> getMessageListener()
MessageListener
for the consumerpublic ConsumerConfiguration setMessageListener(MessageListener<byte[]> messageListener)
MessageListener
for the consumer
When a MessageListener
is set, application will receive messages through it. Calls to
Consumer.receive()
will not be allowed.
messageListener
- the listener objectpublic ConsumerEventListener getConsumerEventListener()
ConsumerEventListener
for the consumer.setConsumerEventListener(ConsumerEventListener)
public ConsumerConfiguration setConsumerEventListener(ConsumerEventListener listener)
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.
listener
- the consumer group listener objectpublic int getReceiverQueueSize()
public int getMaxTotalReceiverQueueSizeAcrossPartitions()
public void setMaxTotalReceiverQueueSizeAcrossPartitions(int maxTotalReceiverQueueSizeAcrossPartitions)
This setting will be used to reduce the receiver queue size for individual partitions
setReceiverQueueSize(int)
if the total exceeds this value (default: 50000).
maxTotalReceiverQueueSizeAcrossPartitions
- public CryptoKeyReader getCryptoKeyReader()
public ConsumerConfiguration setCryptoKeyReader(CryptoKeyReader cryptoKeyReader)
CryptoKeyReader
cryptoKeyReader
- CryptoKeyReader objectpublic void setCryptoFailureAction(ConsumerCryptoFailureAction action)
action
- consumer actionpublic ConsumerCryptoFailureAction getCryptoFailureAction()
public ConsumerConfiguration setReceiverQueueSize(int receiverQueueSize)
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
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.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 removed1000
messages and should be good for most use cases.receiverQueueSize
- the new receiver queue size valuepublic String getConsumerName()
public ConsumerConfiguration setConsumerName(String consumerName)
consumerName
- public int getPriorityLevel()
public void setPriorityLevel(int priorityLevel)
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
priorityLevel
- public boolean getReadCompacted()
public ConsumerConfiguration setReadCompacted(boolean readCompacted)
readCompacted
- whether to read from the compacted topicpublic ConsumerConfiguration setProperty(String key, String value)
key
- value
- public ConsumerConfiguration setProperties(Map<String,String> properties)
properties
- public Map<String,String> getProperties()
public <any> getConfigurationData()
public ConsumerConfiguration setSubscriptionInitialPosition(SubscriptionInitialPosition subscriptionInitialPosition)
subscriptionInitialPosition
- the initial position at which to set
set cursor when subscribing to the topic first time
Default is public SubscriptionInitialPosition getSubscriptionInitialPosition()
subscriptionInitailPosition
for the consumer