public class ConsumerImpl<T> extends ConsumerBase<T>
ConsumerBase.OpBatchReceive<T>| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentOpenHashMap<String,org.apache.pulsar.client.impl.ConsumerImpl.ChunkedMessageCtx> |
chunkedMessagesMap |
protected PulsarClientImpl |
client |
protected long |
expireTimeOfIncompleteChunkedMessageMillis |
protected MessageId |
lastDequeuedMessageId |
protected boolean |
paused |
protected ConsumerStatsRecorder |
stats |
protected String |
topic |
batchReceivePolicy, batchReceiveTimeout, conf, consumerEventListener, consumerName, executorProvider, externalPinnedExecutor, incomingMessagesSize, interceptors, internalPinnedExecutor, listener, maxReceiverQueueSize, pendingBatchReceives, pendingReceives, reentrantLock, schema, subscribeFuture, subscription, unAckedChunkedMessageIdSequenceMap| Modifier | Constructor and Description |
|---|---|
protected |
ConsumerImpl(PulsarClientImpl client,
String topic,
ConsumerConfigurationData<T> conf,
ExecutorProvider executorProvider,
int partitionIndex,
boolean hasParentConsumer,
CompletableFuture<Consumer<T>> subscribeFuture,
MessageId startMessageId,
long startMessageRollbackDurationInSec,
Schema<T> schema,
ConsumerInterceptors<T> interceptors,
boolean createTopicIfDoesNotExist) |
acknowledge, acknowledge, acknowledge, acknowledge, acknowledgeAsync, acknowledgeAsync, acknowledgeAsync, acknowledgeAsync, acknowledgeAsync, acknowledgeCumulative, acknowledgeCumulative, acknowledgeCumulativeAsync, acknowledgeCumulativeAsync, acknowledgeCumulativeAsync, batchReceive, batchReceiveAsync, beforeConsume, callMessageListener, canEnqueueMessage, clearIncomingMessages, close, completePendingBatchReceive, completePendingReceive, decreaseIncomingMessageSize, doAcknowledgeWithTxn, doAcknowledgeWithTxn, enqueueMessageAndCheckBatchReceive, failPendingReceive, getConsumerName, getIncomingMessageSize, getLastMessageId, getNewMessagesImpl, getSubscription, getSubType, getTopic, getTotalIncomingMessages, hasEnoughMessagesForBatchReceive, hasNextPendingReceive, hasPendingBatchReceive, negativeAcknowledge, negativeAcknowledge, nextPendingReceive, notifyPendingBatchReceivedCallBack, notifyPendingBatchReceivedCallBack, onAcknowledge, onAcknowledgeCumulative, onAckTimeoutSend, onNegativeAcksSend, peekMessageKey, receive, receive, receiveAsync, reconsumeLater, reconsumeLater, reconsumeLaterAsync, reconsumeLaterAsync, reconsumeLaterCumulative, reconsumeLaterCumulativeAsync, resetIncomingMessageSize, setMaxReceiverQueueSize, subscribeFuture, toString, triggerListener, unsubscribeprotected volatile MessageId lastDequeuedMessageId
protected final ConsumerStatsRecorder stats
protected volatile boolean paused
protected ConcurrentOpenHashMap<String,org.apache.pulsar.client.impl.ConsumerImpl.ChunkedMessageCtx> chunkedMessagesMap
protected long expireTimeOfIncompleteChunkedMessageMillis
protected final PulsarClientImpl client
protected final String topic
protected ConsumerImpl(PulsarClientImpl client, String topic, ConsumerConfigurationData<T> conf, ExecutorProvider executorProvider, int partitionIndex, boolean hasParentConsumer, CompletableFuture<Consumer<T>> subscribeFuture, MessageId startMessageId, long startMessageRollbackDurationInSec, Schema<T> schema, ConsumerInterceptors<T> interceptors, boolean createTopicIfDoesNotExist)
public ConnectionHandler getConnectionHandler()
public UnAckedMessageTracker getUnAckedMessageTracker()
public CompletableFuture<Void> unsubscribeAsync()
unsubscribeAsync in interface Consumer<T>unsubscribeAsync in class ConsumerBase<T>protected Message<T> internalReceive() throws PulsarClientException
internalReceive in class ConsumerBase<T>PulsarClientExceptionprotected CompletableFuture<Message<T>> internalReceiveAsync()
internalReceiveAsync in class ConsumerBase<T>protected Message<T> internalReceive(int timeout, TimeUnit unit) throws PulsarClientException
internalReceive in class ConsumerBase<T>PulsarClientExceptionprotected Messages<T> internalBatchReceive() throws PulsarClientException
internalBatchReceive in class ConsumerBase<T>PulsarClientExceptionprotected CompletableFuture<Messages<T>> internalBatchReceiveAsync()
internalBatchReceiveAsync in class ConsumerBase<T>protected CompletableFuture<Void> doAcknowledge(MessageId messageId, CommandAck.AckType ackType, Map<String,Long> properties, TransactionImpl txn)
doAcknowledge in class ConsumerBase<T>protected CompletableFuture<Void> doAcknowledge(List<MessageId> messageIdList, CommandAck.AckType ackType, Map<String,Long> properties, TransactionImpl txn)
doAcknowledge in class ConsumerBase<T>protected CompletableFuture<Void> doReconsumeLater(Message<?> message, CommandAck.AckType ackType, Map<String,Long> properties, long delayTime, TimeUnit unit)
doReconsumeLater in class ConsumerBase<T>public void negativeAcknowledge(MessageId messageId)
negativeAcknowledge in interface Consumer<T>public void connectionOpened(ClientCnx cnx)
protected void consumerIsReconnectedToBroker(ClientCnx cnx, int currentQueueSize)
public void connectionFailed(PulsarClientException exception)
public CompletableFuture<Void> closeAsync()
closeAsync in interface Consumer<T>closeAsync in class ConsumerBase<T>protected void messageProcessed(Message<?> msg)
messageProcessed in class ConsumerBase<T>protected void trackMessage(Message<?> msg)
protected void trackMessage(MessageId messageId)
protected void increaseAvailablePermits(ClientCnx currentCnx, int delta)
public void increaseAvailablePermits(int delta)
public long getLastDisconnectedTimestamp()
getLastDisconnectedTimestamp in interface Consumer<T>public boolean isConnected()
isConnected in interface Consumer<T>public int getAvailablePermits()
getAvailablePermits in class ConsumerBase<T>public int numMessagesInQueue()
numMessagesInQueue in class ConsumerBase<T>public void redeliverUnacknowledgedMessages()
redeliverUnacknowledgedMessages in interface Consumer<T>public int clearIncomingMessagesAndGetMessageNumber()
public void redeliverUnacknowledgedMessages(Set<MessageId> messageIds)
ConsumerBaseredeliverUnacknowledgedMessages in class ConsumerBase<T>protected void completeOpBatchReceive(ConsumerBase.OpBatchReceive<T> op)
completeOpBatchReceive in class ConsumerBase<T>public void seek(MessageId messageId) throws PulsarClientException
seek in interface Consumer<T>PulsarClientExceptionpublic void seek(long timestamp)
throws PulsarClientException
seek in interface Consumer<T>PulsarClientExceptionpublic void seek(Function<String,Object> function) throws PulsarClientException
seek in interface Consumer<T>PulsarClientExceptionpublic CompletableFuture<Void> seekAsync(Function<String,Object> function)
public CompletableFuture<Void> seekAsync(long timestamp)
public CompletableFuture<Void> seekAsync(MessageId messageId)
public boolean hasMessageAvailable()
throws PulsarClientException
PulsarClientExceptionpublic CompletableFuture<Boolean> hasMessageAvailableAsync()
public CompletableFuture<MessageId> getLastMessageIdAsync()
getLastMessageIdAsync in interface Consumer<T>getLastMessageIdAsync in class ConsumerBase<T>public CompletableFuture<org.apache.pulsar.client.impl.ConsumerImpl.GetLastMessageIdResponse> internalGetLastMessageIdAsync()
public ConsumerStatsRecorder getStats()
public boolean hasReachedEndOfTopic()
hasReachedEndOfTopic in interface Consumer<T>public ClientCnx getClientCnx()
public String getTopicNameWithoutPartition()
protected void removeExpireIncompleteChunkedMessages()
public Map<MessageIdImpl,List<MessageImpl<T>>> getPossibleSendToDeadLetterTopicMessages()
protected boolean changeToReadyState()
protected boolean changeToRegisteringSchemaState()
protected org.apache.pulsar.client.impl.HandlerState.State getState()
protected void setState(org.apache.pulsar.client.impl.HandlerState.State s)
protected org.apache.pulsar.client.impl.HandlerState.State getAndUpdateState(UnaryOperator<org.apache.pulsar.client.impl.HandlerState.State> updater)
public PulsarClientImpl getClient()
Copyright © 2017–2021 Apache Software Foundation. All rights reserved.