How to check if there is any message for consumer ? before calling consume method in the C# application

Hello Team,

I am looking for a method that can tell me if there is any message available to consume in the C# application.

for example
bool HasMessage();

Any help will be appreciated.

Kind Regards

You could describe the consumer group (using AdminClient class), then check if there is a non-zero the lag of the group for the topic you’re interested in.

If there is lag, then that means that consumer has data to poll.

1 Like