Can this method 
"org.apache.pulsar.client.impl.ConsumerBase#getTotalIncomingMessages" do the 
trick? Though you have to change the type to ConsumerBase.


And maybe `peek` is more suitable and useful to add to the Consumer interface??






------------------ Original ------------------
From:                                                                           
                                             "dev"                              
                                                      <shoot...@gmail.com&gt;;
Date:&nbsp;Mon, Oct 25, 2021 07:24 PM
To:&nbsp;"dev"<dev@pulsar.apache.org&gt;;

Subject:&nbsp;[DISCUSSION] PIP-108: Add method to help user judge if consumer 
queue has message



https://github.com/apache/pulsar/issues/12479

--- Pasted here for quoting convenience ---

## Motivation
Currently, I have an application that manages ten thousand of consumers,
and a logic to schedule consumers's receive. It would be helpful to know if
one of the consumers have message to recive.

## Goal
To make `Consumer` can judge if there are unreceiving messages

## API Changes

Add `hasMessageInReceiverQueue` on the `Consumer` interface.

## Implementation

For `ZeroQueueConsumerImpl` return false, Others, judge the
`receiveQueueSize` greater than zero.


## Reject Alternatives

No alternatives yet.




---
Thanks,
Haiting Jiang (Github: Jason918)

Reply via email to