I have a Spark application that is leaving behind durable subscriptions to Pulsar and makes it look like my backlog is increasing on the topic when all consumers are actually up to date. Is there a way to expire or delete subscriptions that are no longer being used (i.e. not attached to a consumer) and leave other subscriptions (some of which may be idle) alone?
You can configure Pulsar to expire subscriptions that have no consumers connected using the subscriptionExpirationTimeMinutes
setting in the broker.conf
globally or at the namespace level using the following CLI command:
bin/pulsar-admin namespaces set-subscription-expiration-time
Set subscription expiration time for a namespace
Usage: set-subscription-expiration-time [options] tenant/namespace
Options:
* -t, --time
Subscription expiration time in minutes
Default: 0
Setting this to a non-zero value enables the feature.