Class NonPersistentSubscription
java.lang.Object
org.apache.pulsar.broker.service.AbstractSubscription
org.apache.pulsar.broker.service.nonpersistent.NonPersistentSubscription
- All Implemented Interfaces:
MessageExpirer,Subscription
-
Field Summary
Fields inherited from class org.apache.pulsar.broker.service.AbstractSubscription
bytesOutFromRemovedConsumers, msgOutFromRemovedConsumer -
Constructor Summary
ConstructorsConstructorDescriptionNonPersistentSubscription(NonPersistentTopic topic, String subscriptionName, Map<String, String> properties) -
Method Summary
Modifier and TypeMethodDescriptionvoidacknowledgeMessage(List<Position> position, org.apache.pulsar.common.api.proto.CommandAck.AckType ackType, Map<String, Long> properties) addConsumer(Consumer consumer) voidaddUnAckedMessages(int unAckMessages) analyzeBacklog(Optional<Position> position) close(boolean disconnectConsumers, Optional<BrokerLookupData> assignedBrokerLookupData) Fence this subscription and optionally disconnect all consumers.voidconsumerFlow(Consumer consumer, int additionalNumberOfMessages) delete()Delete the subscription by closing and deleting its managed cursor if no consumers are connected to it.Forcefully close all consumers and deletes the subscription.disconnect(Optional<BrokerLookupData> assignedBrokerLookupData) Disconnect all consumers from this subscription.doUnsubscribe(Consumer consumer) Handle unsubscribe command from the client API Check with the dispatcher is this consumer can proceed with unsubscribe.doUnsubscribe(Consumer consumer, boolean force) Handle unsubscribe command from the client API Check with the dispatcher is this consumer can proceed with unsubscribe.endTxn(long txnidMostBits, long txnidLeastBits, int txnAction, long lowWaterMark) booleanexpireMessages(int messageTTLInSeconds) booleanexpireMessages(Position position) doublegetName()longgetNumberOfEntriesInBacklog(boolean getPreciseBacklog) org.apache.pulsar.common.policies.data.stats.NonPersistentSubscriptionStatsImplgetStats(GetStatsOptions getStatsOptions) getTopic()org.apache.pulsar.common.api.proto.CommandSubscribe.SubTypegetType()booleanbooleanvoidpeekNthMessage(int messagePosition) voidredeliverUnacknowledgedMessages(Consumer consumer, long consumerEpoch) voidredeliverUnacknowledgedMessages(Consumer consumer, List<Position> positions) voidremoveConsumer(Consumer consumer, boolean isResetCursor) resetCursor(long timestamp) resetCursor(Position position) skipMessages(int numMessagesToSkip) toString()updateSubscriptionProperties(Map<String, String> subscriptionProperties) Methods inherited from class org.apache.pulsar.broker.service.AbstractSubscription
checkForConsumerCompatibilityErrorWithDispatcher, getBytesOutCounter, getMsgOutCounterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.pulsar.broker.service.Subscription
getNumberOfEntriesDelayed, getNumberOfSameAddressConsumers, processReplicatedSubscriptionSnapshot, removeConsumer
-
Constructor Details
-
NonPersistentSubscription
public NonPersistentSubscription(NonPersistentTopic topic, String subscriptionName, Map<String, String> properties)
-
-
Method Details
-
interceptor
-
getName
-
getTopic
-
isReplicated
public boolean isReplicated() -
addConsumer
-
removeConsumer
- Throws:
BrokerServiceException
-
consumerFlow
-
acknowledgeMessage
-
toString
-
getTopicName
-
getType
public org.apache.pulsar.common.api.proto.CommandSubscribe.SubType getType() -
getTypeString
-
clearBacklog
-
skipMessages
-
resetCursor
-
peekNthMessage
-
getNumberOfEntriesInBacklog
public long getNumberOfEntriesInBacklog(boolean getPreciseBacklog) -
getDispatcher
-
isSubscriptionMigrated
public boolean isSubscriptionMigrated() -
disconnect
Disconnect all consumers from this subscription.- Returns:
- CompletableFuture indicating the completion of the operation.
-
close
public CompletableFuture<Void> close(boolean disconnectConsumers, Optional<BrokerLookupData> assignedBrokerLookupData) Fence this subscription and optionally disconnect all consumers.- Returns:
- CompletableFuture indicating the completion of the operation.
-
delete
Delete the subscription by closing and deleting its managed cursor if no consumers are connected to it. Handle unsubscribe call from admin layer.- Returns:
- CompletableFuture indicating the completion of delete operation
-
deleteForcefully
Forcefully close all consumers and deletes the subscription.- Returns:
-
doUnsubscribe
Handle unsubscribe command from the client API Check with the dispatcher is this consumer can proceed with unsubscribe.- Parameters:
consumer- consumer object that is initiating the unsubscribe operation- Returns:
- CompletableFuture indicating the completion of ubsubscribe operation
-
doUnsubscribe
Handle unsubscribe command from the client API Check with the dispatcher is this consumer can proceed with unsubscribe.- Parameters:
consumer- consumer object that is initiating the unsubscribe operationforce- unsubscribe forcefully by disconnecting consumers and closing subscription- Returns:
- CompletableFuture indicating the completion of ubsubscribe operation
-
getConsumers
-
expireMessages
public boolean expireMessages(int messageTTLInSeconds) -
expireMessages
-
getStats
public org.apache.pulsar.common.policies.data.stats.NonPersistentSubscriptionStatsImpl getStats(GetStatsOptions getStatsOptions) -
redeliverUnacknowledgedMessages
-
redeliverUnacknowledgedMessages
-
addUnAckedMessages
public void addUnAckedMessages(int unAckMessages) -
getExpiredMessageRate
public double getExpiredMessageRate() -
markTopicWithBatchMessagePublished
public void markTopicWithBatchMessagePublished() -
resetCursor
-
endTxn
public CompletableFuture<Void> endTxn(long txnidMostBits, long txnidLeastBits, int txnAction, long lowWaterMark) -
analyzeBacklog
-
getSubscriptionProperties
-
updateSubscriptionProperties
public CompletableFuture<Void> updateSubscriptionProperties(Map<String, String> subscriptionProperties)
-