How to get the queued tasks (not yet consumed messages) when using Apache Pulsar as a distributed task queue?

108 Views Asked by At

I am currently evaluating the suitability of Apache Pulsar for building a distributed task queue using a "shared" subscription.

One required feature is to get all queued tasks for certain topics, or to get at least the number of queued tasks.By this I mean all messages for a given subscription that have not been received by the subscription consumers yet. Is this possible, and if so, how?

1

There are 1 best solutions below

0
Gilles Barbier On

you can request the subscription's stats https://pulsar.apache.org/docs/next/administration-stats/#subscription-stats through the Admin API - the msgBacklog value should give you what you are looking for.