apache / apache/pulsar

Discuss: Make hasMessageAvailable to interface Consumer.

Open
#16,358 4 comments 1 reaction 0 assignees View on GitHub
Stale type/bug
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

Now the method `hasMessageAvailable` just is announced in ConsumerImpl and MultiConsumerImpl.
If we want to check is there message available, we should transfer Consumer to ConsumerImpl or MultiConsumerImpl,
then invoke hasMessageAvailable like below:
```
if (consumer instanceof ConsumerImpl) {
return ((ConsumerImpl) consumer).hasMessageAvailable();
} else if (consumer instanceof MultiTopicsConsumerImpl) {
return ((MultiTopicsConsumerImpl) consumer).hasMessageAvailable();
}
```

Maybe we can make method `hasMessageAvailable` to Consumer.

Contributor guide

Open the contributing guide

Research direction

Start with the Consumer interface and the hasMessageAvailable implementations in ConsumerImpl and MultiTopicsConsumerImpl. Trace the existing call sites shown in the issue and check the related consumer tests; done means the availability check is exposed consistently through Consumer and the existing behavior remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.