类 ConsumerBase<T>
java.lang.Object
org.apache.pulsar.client.impl.ConsumerBase<T>
- 所有已实现的接口:
Closeable,AutoCloseable,Consumer<T>,MessageAcknowledger
- 直接已知子类:
ConsumerImpl,MultiTopicsConsumerImpl
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明protected final BatchReceivePolicyprotected io.netty.util.Timeoutprotected final PulsarClientImplprotected final ConsumerConfigurationData<T>protected static final AtomicLongFieldUpdater<ConsumerBase>protected longprotected final ConsumerEventListenerprotected final Stringprotected static final AtomicIntegerFieldUpdater<ConsumerBase>protected final ExecutorProviderprotected final ExecutorServiceprotected longprotected final Lockprotected static final intprotected final ConsumerInterceptors<T>protected final ExecutorServiceprotected final MessageListener<T>protected final intprotected static final doubleprotected static final AtomicIntegerFieldUpdater<ConsumerBase>protected intprotected final ConcurrentLinkedQueue<ConsumerBase.OpBatchReceive<T>>protected final ConcurrentLinkedQueue<CompletableFuture<Message<T>>>protected URIprotected final AtomicBooleanprotected final CompletableFuture<Consumer<T>>protected final Stringprotected final Stringprotected ConcurrentOpenHashMap<MessageIdAdv,MessageIdImpl[]> protected UnAckedMessageTracker -
构造器概要
构造器限定符构造器说明protectedConsumerBase(PulsarClientImpl client, String topic, ConsumerConfigurationData<T> conf, int receiverQueueSize, ExecutorProvider executorProvider, CompletableFuture<Consumer<T>> subscribeFuture, Schema<T> schema, ConsumerInterceptors interceptors) -
方法概要
修饰符和类型方法说明voidacknowledge(List<MessageId> messageIdList) voidacknowledge(Message<?> message) voidacknowledge(MessageId messageId) voidacknowledge(Messages<?> messages) acknowledgeAsync(List<MessageId> messageIdList) acknowledgeAsync(List<MessageId> messageIdList, Transaction txn) acknowledgeAsync(Message<?> message) acknowledgeAsync(MessageId messageId) acknowledgeAsync(MessageId messageId, Transaction txn) acknowledgeAsync(Messages<?> messages) acknowledgeAsync(Messages<?> messages, Transaction txn) voidacknowledgeCumulative(Message<?> message) voidacknowledgeCumulative(MessageId messageId) acknowledgeCumulativeAsync(Message<?> message) acknowledgeCumulativeAsync(MessageId messageId) acknowledgeCumulativeAsync(MessageId messageId, Transaction txn) beforeConsume(Message<T> message) protected voidcallMessageListener(Message<T> msg) protected booleancanEnqueueMessage(Message<T> message) protected booleanprotected booleanprotected booleanprotected voidvoidclose()abstract CompletableFuture<Void>protected abstract voidprotected voidcompletePendingBatchReceive(CompletableFuture<Messages<T>> future, Messages<T> messages) protected voidcompletePendingReceive(CompletableFuture<Message<T>> receivedFuture, Message<T> message) protected voiddecreaseIncomingMessageSize(Message<?> message) protected abstract CompletableFuture<Void>doAcknowledge(List<MessageId> messageIdList, CommandAck.AckType ackType, Map<String, Long> properties, TransactionImpl txn) protected abstract CompletableFuture<Void>doAcknowledge(MessageId messageId, CommandAck.AckType ackType, Map<String, Long> properties, TransactionImpl txn) protected CompletableFuture<Void>doAcknowledgeWithTxn(List<MessageId> messageIdList, CommandAck.AckType ackType, Map<String, Long> properties, TransactionImpl txn) protected CompletableFuture<Void>doAcknowledgeWithTxn(MessageId messageId, CommandAck.AckType ackType, Map<String, Long> properties, TransactionImpl txn) protected abstract CompletableFuture<Void>doReconsumeLater(Message<?> message, CommandAck.AckType ackType, Map<String, String> customProperties, long delayTime, TimeUnit unit) protected booleanenqueueMessageAndCheckBatchReceive(Message<T> message) protected voidprotected CompletableFuture<Void>protected org.apache.pulsar.client.impl.HandlerState.StategetAndUpdateState(UnaryOperator<org.apache.pulsar.client.impl.HandlerState.State> updater) abstract intintlong已过时。abstract CompletableFuture<MessageId>已过时。protected MessagesImpl<T>protected org.apache.pulsar.client.impl.HandlerState.StategetState()protected CommandSubscribe.SubTypegetTopic()intprotected UnAckedMessageTrackerbooleanprotected booleanprotected booleanprotected booleanvoidprotected abstract CompletableFuture<Messages<T>>internalReceive(long timeout, TimeUnit unit) protected abstract CompletableFuture<Message<T>>protected booleanisSingleMessageAcked(BitSetRecyclable ackBitSet, int batchIndex) protected booleanisValidConsumerEpoch(MessageImpl<T> message) protected abstract voidmessageProcessed(Message<?> msg) abstract intvoidnegativeAcknowledge(Message<?> message) voidnegativeAcknowledge(Messages<?> messages) protected CompletableFuture<Message<T>>protected voidprotected final voidnotifyPendingBatchReceivedCallBack(CompletableFuture<Messages<T>> batchReceiveFuture) abstract intprotected voidonAcknowledge(List<MessageId> messageIds, Throwable exception) protected voidonAcknowledge(MessageId messageId, Throwable exception) protected voidonAcknowledgeCumulative(List<MessageId> messageIds, Throwable exception) protected voidonAcknowledgeCumulative(MessageId messageId, Throwable exception) protected voidonAckTimeoutSend(Set<MessageId> messageIds) protected voidonNegativeAcksSend(Set<MessageId> messageIds) protected voidonPartitionsChange(String topicName, int partitions) protected byte[]peekMessageKey(Message<T> msg) receive()voidreconsumeLater(Message<?> message, long delayTime, TimeUnit unit) voidreconsumeLater(Message<?> message, Map<String, String> customProperties, long delayTime, TimeUnit unit) voidreconsumeLater(Messages<?> messages, long delayTime, TimeUnit unit) reconsumeLaterAsync(Message<?> message, long delayTime, TimeUnit unit) reconsumeLaterAsync(Message<?> message, Map<String, String> customProperties, long delayTime, TimeUnit unit) reconsumeLaterAsync(Messages<?> messages, long delayTime, TimeUnit unit) voidreconsumeLaterCumulative(Message<?> message, long delayTime, TimeUnit unit) reconsumeLaterCumulativeAsync(Message<?> message, long delayTime, TimeUnit unit) reconsumeLaterCumulativeAsync(Message<?> message, Map<String, String> customProperties, long delayTime, TimeUnit unit) protected abstract voidredeliverUnacknowledgedMessages(Set<MessageId> messageIds) Redelivers the given unacknowledged messages.protected voidprotected voidprotected abstract voidsetCurrentReceiverQueueSize(int newSize) Update the size of the consumer receive queue.protected voidsetRedirectedClusterURI(String serviceUrl, String serviceUrlTls) protected voidsetState(org.apache.pulsar.client.impl.HandlerState.State s) toString()protected voidtrackUnAckedMsgIfNoListener(MessageId messageId, int redeliveryCount) protected voidprotected voidvoidvoidunsubscribe(boolean force) abstract CompletableFuture<Void>unsubscribeAsync(boolean force) protected abstract void从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait从接口继承的方法 org.apache.pulsar.client.api.Consumer
getLastDisconnectedTimestamp, getLastMessageIdsAsync, getStats, hasReachedEndOfTopic, isConnected, negativeAcknowledge, pause, redeliverUnacknowledgedMessages, resume, seek, seek, seek, seekAsync, seekAsync, seekAsync
-
字段详细资料
-
INITIAL_RECEIVER_QUEUE_SIZE
protected static final int INITIAL_RECEIVER_QUEUE_SIZE- 另请参阅:
-
MEMORY_THRESHOLD_FOR_RECEIVER_QUEUE_SIZE_EXPANSION
protected static final double MEMORY_THRESHOLD_FOR_RECEIVER_QUEUE_SIZE_EXPANSION- 另请参阅:
-
subscription
-
conf
-
consumerName
-
subscribeFuture
-
listener
-
consumerEventListener
-
executorProvider
-
externalPinnedExecutor
-
internalPinnedExecutor
-
unAckedMessageTracker
-
unAckedChunkedMessageIdSequenceMap
-
pendingReceives
-
maxReceiverQueueSize
protected final int maxReceiverQueueSize -
MESSAGE_LISTENER_QUEUE_SIZE_UPDATER
-
messageListenerQueueSize
protected volatile int messageListenerQueueSize -
CURRENT_RECEIVER_QUEUE_SIZE_UPDATER
-
schema
-
interceptors
-
batchReceivePolicy
-
pendingBatchReceives
-
incomingMessagesSize
protected volatile long incomingMessagesSize -
batchReceiveTimeout
protected volatile io.netty.util.Timeout batchReceiveTimeout -
incomingQueueLock
-
CONSUMER_EPOCH
-
consumerEpoch
protected volatile long consumerEpoch -
scaleReceiverQueueHint
-
client
-
topic
-
redirectedClusterURI
-
-
构造器详细资料
-
ConsumerBase
protected ConsumerBase(PulsarClientImpl client, String topic, ConsumerConfigurationData<T> conf, int receiverQueueSize, ExecutorProvider executorProvider, CompletableFuture<Consumer<T>> subscribeFuture, Schema<T> schema, ConsumerInterceptors interceptors)
-
-
方法详细资料
-
getUnAckedMessageTracker
-
triggerBatchReceiveTimeoutTask
protected void triggerBatchReceiveTimeoutTask() -
initReceiverQueueSize
public void initReceiverQueueSize() -
minReceiverQueueSize
public abstract int minReceiverQueueSize() -
expectMoreIncomingMessages
protected void expectMoreIncomingMessages() -
trackUnAckedMsgIfNoListener
-
reduceCurrentReceiverQueueSize
protected void reduceCurrentReceiverQueueSize() -
receive
- 指定者:
receive在接口中Consumer<T>- 抛出:
PulsarClientException
-
receiveAsync
- 指定者:
receiveAsync在接口中Consumer<T>
-
internalReceive
-
internalReceiveAsync
-
receive
- 指定者:
receive在接口中Consumer<T>- 抛出:
PulsarClientException
-
internalReceive
protected abstract Message<T> internalReceive(long timeout, TimeUnit unit) throws PulsarClientException -
batchReceive
- 指定者:
batchReceive在接口中Consumer<T>- 抛出:
PulsarClientException
-
batchReceiveAsync
- 指定者:
batchReceiveAsync在接口中Consumer<T>
-
hasNextPendingReceive
protected boolean hasNextPendingReceive() -
nextPendingReceive
-
completePendingReceive
protected void completePendingReceive(CompletableFuture<Message<T>> receivedFuture, Message<T> message) -
failPendingReceive
-
internalBatchReceive
-
internalBatchReceiveAsync
-
acknowledge
- 指定者:
acknowledge在接口中MessageAcknowledger- 抛出:
PulsarClientException
-
acknowledge
- 指定者:
acknowledge在接口中MessageAcknowledger- 抛出:
PulsarClientException
-
acknowledge
- 指定者:
acknowledge在接口中MessageAcknowledger- 抛出:
PulsarClientException
-
acknowledge
- 指定者:
acknowledge在接口中MessageAcknowledger- 抛出:
PulsarClientException
-
reconsumeLater
public void reconsumeLater(Message<?> message, long delayTime, TimeUnit unit) throws PulsarClientException - 指定者:
reconsumeLater在接口中Consumer<T>- 抛出:
PulsarClientException
-
reconsumeLater
public void reconsumeLater(Message<?> message, Map<String, String> customProperties, long delayTime, TimeUnit unit) throws PulsarClientException- 指定者:
reconsumeLater在接口中Consumer<T>- 抛出:
PulsarClientException
-
reconsumeLater
public void reconsumeLater(Messages<?> messages, long delayTime, TimeUnit unit) throws PulsarClientException - 指定者:
reconsumeLater在接口中Consumer<T>- 抛出:
PulsarClientException
-
acknowledgeCumulative
- 指定者:
acknowledgeCumulative在接口中MessageAcknowledger- 抛出:
PulsarClientException
-
acknowledgeCumulative
- 指定者:
acknowledgeCumulative在接口中MessageAcknowledger- 抛出:
PulsarClientException
-
reconsumeLaterCumulative
public void reconsumeLaterCumulative(Message<?> message, long delayTime, TimeUnit unit) throws PulsarClientException - 指定者:
reconsumeLaterCumulative在接口中Consumer<T>- 抛出:
PulsarClientException
-
acknowledgeAsync
- 指定者:
acknowledgeAsync在接口中MessageAcknowledger
-
acknowledgeAsync
- 指定者:
acknowledgeAsync在接口中MessageAcknowledger
-
acknowledgeAsync
- 指定者:
acknowledgeAsync在接口中MessageAcknowledger
-
acknowledgeAsync
- 指定者:
acknowledgeAsync在接口中MessageAcknowledger
-
acknowledgeAsync
- 指定者:
acknowledgeAsync在接口中MessageAcknowledger
-
reconsumeLaterAsync
public CompletableFuture<Void> reconsumeLaterAsync(Message<?> message, long delayTime, TimeUnit unit) - 指定者:
reconsumeLaterAsync在接口中Consumer<T>
-
reconsumeLaterAsync
public CompletableFuture<Void> reconsumeLaterAsync(Message<?> message, Map<String, String> customProperties, long delayTime, TimeUnit unit) - 指定者:
reconsumeLaterAsync在接口中Consumer<T>
-
reconsumeLaterAsync
public CompletableFuture<Void> reconsumeLaterAsync(Messages<?> messages, long delayTime, TimeUnit unit) - 指定者:
reconsumeLaterAsync在接口中Consumer<T>
-
acknowledgeCumulativeAsync
-
reconsumeLaterCumulativeAsync
public CompletableFuture<Void> reconsumeLaterCumulativeAsync(Message<?> message, long delayTime, TimeUnit unit) - 指定者:
reconsumeLaterCumulativeAsync在接口中Consumer<T>
-
reconsumeLaterCumulativeAsync
public CompletableFuture<Void> reconsumeLaterCumulativeAsync(Message<?> message, Map<String, String> customProperties, long delayTime, TimeUnit unit) - 指定者:
reconsumeLaterCumulativeAsync在接口中Consumer<T>
-
acknowledgeAsync
- 指定者:
acknowledgeAsync在接口中MessageAcknowledger
-
acknowledgeAsync
- 指定者:
acknowledgeAsync在接口中MessageAcknowledger
-
acknowledgeCumulativeAsync
-
acknowledgeCumulativeAsync
-
negativeAcknowledge
- 指定者:
negativeAcknowledge在接口中Consumer<T>
-
doAcknowledgeWithTxn
protected CompletableFuture<Void> doAcknowledgeWithTxn(List<MessageId> messageIdList, CommandAck.AckType ackType, Map<String, Long> properties, TransactionImpl txn) -
doAcknowledgeWithTxn
protected CompletableFuture<Void> doAcknowledgeWithTxn(MessageId messageId, CommandAck.AckType ackType, Map<String, Long> properties, TransactionImpl txn) -
doAcknowledge
protected abstract CompletableFuture<Void> doAcknowledge(MessageId messageId, CommandAck.AckType ackType, Map<String, Long> properties, TransactionImpl txn) -
doAcknowledge
protected abstract CompletableFuture<Void> doAcknowledge(List<MessageId> messageIdList, CommandAck.AckType ackType, Map<String, Long> properties, TransactionImpl txn) -
doReconsumeLater
protected abstract CompletableFuture<Void> doReconsumeLater(Message<?> message, CommandAck.AckType ackType, Map<String, String> customProperties, long delayTime, TimeUnit unit) -
negativeAcknowledge
- 指定者:
negativeAcknowledge在接口中Consumer<T>
-
unsubscribe
- 指定者:
unsubscribe在接口中Consumer<T>- 抛出:
PulsarClientException
-
unsubscribe
- 指定者:
unsubscribe在接口中Consumer<T>- 抛出:
PulsarClientException
-
unsubscribeAsync
- 指定者:
unsubscribeAsync在接口中Consumer<T>
-
unsubscribeAsync
- 指定者:
unsubscribeAsync在接口中Consumer<T>
-
close
- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Closeable- 指定者:
close在接口中Consumer<T>- 抛出:
PulsarClientException
-
closeAsync
- 指定者:
closeAsync在接口中Consumer<T>
-
getLastMessageId
已过时。- 指定者:
getLastMessageId在接口中Consumer<T>- 抛出:
PulsarClientException
-
getLastMessageIdAsync
已过时。- 指定者:
getLastMessageIdAsync在接口中Consumer<T>
-
getLastMessageIds
- 指定者:
getLastMessageIds在接口中Consumer<T>- 抛出:
PulsarClientException
-
getSubType
-
getAvailablePermits
public abstract int getAvailablePermits() -
numMessagesInQueue
public abstract int numMessagesInQueue() -
subscribeFuture
-
getTopic
-
getSubscription
- 指定者:
getSubscription在接口中Consumer<T>
-
getConsumerName
- 指定者:
getConsumerName在接口中Consumer<T>
-
redeliverUnacknowledgedMessages
Redelivers the given unacknowledged messages. In Failover mode, the request is ignored if the consumer is not active for the given topic. In Shared mode, the consumers messages to be redelivered are distributed across all the connected consumers. This is a non blocking call and doesn't throw an exception. In case the connection breaks, the messages are redelivered after reconnect. -
toString
-
beforeConsume
-
onAcknowledge
-
onAcknowledge
-
onAcknowledgeCumulative
-
onAcknowledgeCumulative
-
onNegativeAcksSend
-
onAckTimeoutSend
-
onPartitionsChange
-
canEnqueueMessage
-
enqueueMessageAndCheckBatchReceive
-
updateAutoScaleReceiverQueueHint
protected abstract void updateAutoScaleReceiverQueueHint() -
hasEnoughMessagesForBatchReceive
protected boolean hasEnoughMessagesForBatchReceive() -
notifyPendingBatchReceivedCallBack
protected void notifyPendingBatchReceivedCallBack() -
notifyPendingBatchReceivedCallBack
protected final void notifyPendingBatchReceivedCallBack(CompletableFuture<Messages<T>> batchReceiveFuture) -
completePendingBatchReceive
protected void completePendingBatchReceive(CompletableFuture<Messages<T>> future, Messages<T> messages) -
messageProcessed
-
tryTriggerListener
protected void tryTriggerListener() -
callMessageListener
-
peekMessageKey
-
getNewMessagesImpl
-
hasPendingBatchReceive
protected boolean hasPendingBatchReceive() -
resetIncomingMessageSize
protected void resetIncomingMessageSize() -
decreaseIncomingMessageSize
-
getIncomingMessageSize
public long getIncomingMessageSize() -
getTotalIncomingMessages
public int getTotalIncomingMessages() -
clearIncomingMessages
protected void clearIncomingMessages() -
setCurrentReceiverQueueSize
protected abstract void setCurrentReceiverQueueSize(int newSize) Update the size of the consumer receive queue. SeeConsumerBuilder.receiverQueueSize(int).- 参数:
newSize- new size of the receiver queue.
-
getCurrentReceiverQueueSize
public int getCurrentReceiverQueueSize() -
completeOpBatchReceive
-
isValidConsumerEpoch
-
isSingleMessageAcked
-
hasBatchReceiveTimeout
public boolean hasBatchReceiveTimeout() -
setRedirectedClusterURI
protected void setRedirectedClusterURI(String serviceUrl, String serviceUrlTls) throws URISyntaxException -
changeToReadyState
protected boolean changeToReadyState() -
changeToRegisteringSchemaState
protected boolean changeToRegisteringSchemaState() -
getState
protected org.apache.pulsar.client.impl.HandlerState.State getState() -
changeToConnecting
protected boolean changeToConnecting() -
setState
protected void setState(org.apache.pulsar.client.impl.HandlerState.State s) -
getAndUpdateState
protected org.apache.pulsar.client.impl.HandlerState.State getAndUpdateState(UnaryOperator<org.apache.pulsar.client.impl.HandlerState.State> updater) -
getClient
-