public class MultiTopicsConsumerImpl<T> extends ConsumerBase<T>
| Modifier and Type | Field and Description |
|---|---|
protected PulsarClientImpl |
client |
protected NamespaceName |
namespaceName |
protected String |
topic |
protected ConcurrentHashMap<String,Integer> |
topics |
conf, consumerEventListener, consumerName, interceptors, listener, listenerExecutor, maxReceiverQueueSize, pendingReceives, schema, subscribeFuture, subscription| Modifier and Type | Method and Description |
|---|---|
protected boolean |
changeToReadyState() |
CompletableFuture<Void> |
closeAsync()
Asynchronously close the consumer and stop the broker to push more messages
|
static <T> MultiTopicsConsumerImpl<T> |
createPartitionedConsumer(PulsarClientImpl client,
ConsumerConfigurationData<T> conf,
ExecutorService listenerExecutor,
CompletableFuture<Consumer<T>> subscribeFuture,
int numPartitions,
Schema<T> schema,
ConsumerInterceptors<T> interceptors) |
protected CompletableFuture<Void> |
doAcknowledge(MessageId messageId,
PulsarApi.CommandAck.AckType ackType,
Map<String,Long> properties) |
protected org.apache.pulsar.client.impl.HandlerState.State |
getAndUpdateState(UnaryOperator<org.apache.pulsar.client.impl.HandlerState.State> updater) |
int |
getAvailablePermits() |
PulsarClientImpl |
getClient() |
List<ConsumerImpl<T>> |
getConsumers() |
List<String> |
getPartitionedTopics() |
protected org.apache.pulsar.client.impl.HandlerState.State |
getState() |
ConsumerStats |
getStats()
Get statistics for the consumer.
|
List<String> |
getTopics() |
UnAckedMessageTracker |
getUnAckedMessageTracker() |
boolean |
hasReachedEndOfTopic()
Return true if the topic was terminated and this consumer has already consumed all the messages in the topic.
|
protected Message<T> |
internalReceive() |
protected Message<T> |
internalReceive(int timeout,
TimeUnit unit) |
protected CompletableFuture<Message<T>> |
internalReceiveAsync() |
boolean |
isConnected() |
int |
numMessagesInQueue() |
void |
redeliverUnacknowledgedMessages()
Redelivers all the unacknowledged messages.
|
void |
redeliverUnacknowledgedMessages(Set<MessageId> messageIds)
Redelivers the given unacknowledged messages.
|
void |
seek(MessageId messageId)
Reset the subscription associated with this consumer to a specific message id.
|
CompletableFuture<Void> |
seekAsync(MessageId messageId)
Reset the subscription associated with this consumer to a specific message id.
|
protected void |
setState(org.apache.pulsar.client.impl.HandlerState.State s) |
CompletableFuture<Void> |
subscribeAsync(String topicName) |
CompletableFuture<Void> |
unsubscribeAsync()
Asynchronously unsubscribe the consumer
|
CompletableFuture<Void> |
unsubscribeAsync(String topicName) |
acknowledge, acknowledge, acknowledgeAsync, acknowledgeAsync, acknowledgeCumulative, acknowledgeCumulative, acknowledgeCumulativeAsync, acknowledgeCumulativeAsync, beforeConsume, close, getConsumerName, getSubscription, getSubType, getTopic, onAcknowledge, onAcknowledgeCumulative, receive, receive, receiveAsync, setMaxReceiverQueueSize, subscribeFuture, toString, unsubscribeprotected NamespaceName namespaceName
protected final ConcurrentHashMap<String,Integer> topics
protected final PulsarClientImpl client
protected final String topic
protected Message<T> internalReceive() throws PulsarClientException
internalReceive in class ConsumerBase<T>PulsarClientExceptionprotected Message<T> internalReceive(int timeout, TimeUnit unit) throws PulsarClientException
internalReceive in class ConsumerBase<T>PulsarClientExceptionprotected CompletableFuture<Message<T>> internalReceiveAsync()
internalReceiveAsync in class ConsumerBase<T>protected CompletableFuture<Void> doAcknowledge(MessageId messageId, PulsarApi.CommandAck.AckType ackType, Map<String,Long> properties)
doAcknowledge in class ConsumerBase<T>public CompletableFuture<Void> unsubscribeAsync()
ConsumerunsubscribeAsync in interface Consumer<T>unsubscribeAsync in class ConsumerBase<T>CompletableFuture for this operationpublic CompletableFuture<Void> closeAsync()
ConsumercloseAsync in interface Consumer<T>closeAsync in class ConsumerBase<T>public boolean isConnected()
public void redeliverUnacknowledgedMessages()
Consumerpublic void redeliverUnacknowledgedMessages(Set<MessageId> messageIds)
ConsumerBaseredeliverUnacknowledgedMessages in class ConsumerBase<T>public void seek(MessageId messageId) throws PulsarClientException
ConsumerThe message id can either be a specific message or represent the first or last messages in the topic.
MessageId.earliest : Reset the subscription on the earliest message available in the topic
MessageId.latest : Reset the subscription on the latest message in the topic
messageId - the message id where to reposition the subscriptionPulsarClientExceptionpublic CompletableFuture<Void> seekAsync(MessageId messageId)
ConsumerThe message id can either be a specific message or represent the first or last messages in the topic.
MessageId.earliest : Reset the subscription on the earliest message available in the topic
MessageId.latest : Reset the subscription on the latest message in the topic
messageId - the message id where to reposition the subscriptionpublic int getAvailablePermits()
getAvailablePermits in class ConsumerBase<T>public boolean hasReachedEndOfTopic()
Consumerpublic int numMessagesInQueue()
numMessagesInQueue in class ConsumerBase<T>public ConsumerStats getStats()
Consumerpublic UnAckedMessageTracker getUnAckedMessageTracker()
public CompletableFuture<Void> subscribeAsync(String topicName)
public static <T> MultiTopicsConsumerImpl<T> createPartitionedConsumer(PulsarClientImpl client, ConsumerConfigurationData<T> conf, ExecutorService listenerExecutor, CompletableFuture<Consumer<T>> subscribeFuture, int numPartitions, Schema<T> schema, ConsumerInterceptors<T> interceptors)
public CompletableFuture<Void> unsubscribeAsync(String topicName)
public List<ConsumerImpl<T>> getConsumers()
protected boolean changeToReadyState()
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–2018 Apache Software Foundation. All rights reserved.