Interface RqueueQueueMetricsProvider
public interface RqueueQueueMetricsProvider
Backend-agnostic provider of queue-depth metrics. Each backend (Redis, NATS, ...) supplies its
own implementation; consumers like
RqueueMetrics read sizes through this interface
instead of reaching into a Redis-shaped DAO.
The queueName argument is the user-facing queue name (the value bound on
@RqueueListener(value="...")), not an internal storage key. Implementations are
responsible for mapping it to the appropriate backend-specific key(s).
Implementations must return 0 when a queue has no messages of the requested kind
(rather than throwing) so callers can use the values directly as gauge readings.
-
Method Summary
Modifier and TypeMethodDescriptionlonggetDeadLetterMessageCount(String queueName) Number of messages in the dead-letter queue associated withqueueName.longgetPendingMessageCount(String queueName) Number of messages waiting to be consumed fromqueueName— i.e.default longgetPendingMessageCount(String queueName, String priority) Priority-aware variant ofgetPendingMessageCount(String).default longgetPendingMessageCountByConsumer(String queueName, String consumerName) Per-consumer variant ofgetPendingMessageCount(String).longgetProcessingMessageCount(String queueName) Number of messages currently in-flight forqueueName— handed to a worker but not yet acked or nacked.default longgetProcessingMessageCount(String queueName, String priority) Priority-aware variant ofgetProcessingMessageCount(String).default longgetProcessingMessageCountByConsumer(String queueName, String consumerName) Per-consumer variant ofgetProcessingMessageCount(String).longgetScheduledMessageCount(String queueName) Number of messages enqueued toqueueNamewith a future delivery time that has not yet elapsed.default longgetScheduledMessageCount(String queueName, String priority) Priority-aware variant ofgetScheduledMessageCount(String).
-
Method Details
-
getPendingMessageCount
Number of messages waiting to be consumed fromqueueName— i.e. enqueued and ready for a worker to pick up, excluding messages already in-flight (processing) or scheduled for a future delivery time. -
getScheduledMessageCount
Number of messages enqueued toqueueNamewith a future delivery time that has not yet elapsed. Backends that don't support delayed delivery return0. -
getProcessingMessageCount
Number of messages currently in-flight forqueueName— handed to a worker but not yet acked or nacked. Backends without an explicit in-flight set return0. -
getDeadLetterMessageCount
Number of messages in the dead-letter queue associated withqueueName. Returns0when no DLQ is configured for the queue or the backend does not surface DLQ depth. -
getPendingMessageCount
Priority-aware variant ofgetPendingMessageCount(String). The default implementation ignores priority and returns the parent queue depth, which is the right behaviour for backends that don't model per-priority sub-queues. -
getScheduledMessageCount
Priority-aware variant ofgetScheduledMessageCount(String). -
getProcessingMessageCount
Priority-aware variant ofgetProcessingMessageCount(String). -
getPendingMessageCountByConsumer
Per-consumer variant ofgetPendingMessageCount(String). When two@RqueueListenermethods on the same queue declare differentconsumerNameoverrides, each gets its own QueueDetail and its own metric registration; backends that can report per-consumer pending depth (e.g. NATS JetStream Limits/Interest streams or any fan-out broker) should override this. The default delegates to the queue-level call so single-consumer queues, and backends without per-consumer state, behave unchanged.- Parameters:
queueName- user-facing queue nameconsumerName- consumer-name override from@RqueueListener(consumerName=...);nullor empty when no override is set
-
getProcessingMessageCountByConsumer
Per-consumer variant ofgetProcessingMessageCount(String). See related javadoc.
-