apache / apache/pulsar

Reader and TableView should support regex pattern matching

Open
#22,195 0 comments 0 reactions 1 assignee Claimed by @tsturzl View on GitHub
area/client type/feature
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.

### Motivation

Multi-topic Readers already exist, but unlike Consumers a multi-topic Reader cannot be built from a regex pattern. If the Reader interface supported this then TableView, which is backed by Reader, should easily be able to also allow regex pattern matching on topics. This is really useful for event sourcing, where you may want to read from a certain point in time.

### Solution

The MultiTopicReaderImpl class already uses a MultiTopicsComsunerImpl internally. The PatternMultiTopicsConsumerImpl class extends the MultiTopicsComsunerImpl, so the MultiTopicReaderImpl can likely just use a PatternMultiTopicConsumerImpl whenever the ReaderConfigurationData suggests in.

### Alternatives

You can technically use a Consumer similarly to a Reader, by starting a Consumer with a new subscription each time so you don't pick up at the last acknowledged message. This is dirty however, and doesn't provide all the features of a Reader nor does it allow you to use a TableView.

### Anything else?

_No response_

### Are you willing to submit a PR?

- [X] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.