Skip to content

Conversation

@coderzc
Copy link
Member

@coderzc coderzc commented Jan 11, 2026

Fixes #xyz

Main Issue: #xyz

PIP: #xyz

Motivation

Modifications

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@github-actions github-actions bot added PIP doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. labels Jan 11, 2026
@coderzc coderzc force-pushed the pip-452 branch 11 times, most recently from 06e3b36 to 7348e97 Compare January 12, 2026 16:42
pip/pip-452.md Outdated
* Return an invalid result indicating that the caller should continue with the default logic.
*/
public static TopicListingResult passThrough() {
return PASS_THROUGH_INSTANCE;
Copy link
Contributor

@BewareMyPower BewareMyPower Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This design is a bit over-abstraction. IMO, the following design could be simpler and clearer.

public record TopicListingResult(List<String> topics, boolean filtered) {}
    /**
     * @return the future of the result, if it's empty, fall back to the built-in implementation to list all topics
     */
    default CompletableFuture<Optional<TopicListingResult>> interceptGetTopicsOfNamespace(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the built-in implementation is very simple that calls method directly on the NamespaceService, I think the fallback logic is unnecessary.

Copy link
Member Author

@coderzc coderzc Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we allow the configuration of multiple interceptors, the return here means that the result of current interception is not processed this method. If all the interceptors do not process the method, the default logic will be used.

In addition, the interception configuration is empty by default. In this case, we still need to fall back to the default logic.

Copy link
Member Author

@coderzc coderzc Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default CompletableFuture<Optional<TopicListingResult>> interceptGetTopicsOfNamespace()

Applied this suggestion

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces PIP-452, which proposes a design for customizable topic listing in Pulsar's GetTopicsOfNamespace command. The proposal aims to make topic discovery more flexible by allowing clients to pass context properties and enabling plugins to override the default metadata store scanning behavior.

Changes:

  • Adds protocol extension to include properties field in CommandGetTopicsOfNamespace
  • Introduces BrokerInterceptor interface method for custom topic listing logic
  • Extends REST API and CLI to support properties parameter for topic listing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderzc coderzc changed the title [feat][broker] PIP-452: Customizable Topic Listing in GetTopicsOfNamespace with properties [feat][broker] PIP-452: Customizable topic listing of namespace with properties Jan 14, 2026
@coderzc coderzc force-pushed the pip-452 branch 2 times, most recently from cfa592c to 70224d9 Compare January 14, 2026 06:19
@coderzc coderzc added this to the 4.2.0 milestone Jan 14, 2026
@coderzc coderzc changed the title [feat][broker] PIP-452: Customizable topic listing of namespace with properties [feat][pip] PIP-452: Customizable topic listing of namespace with properties Jan 18, 2026

CLI:
```
pulsar-admin topics list <tenant>/<namespace> -p k1=v1 -p k2=v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pulsar-admin topics list <tenant>/<namespace> -p k1=v1 -p k2=v2
pulsar-admin topics list <tenant>/<namespace> -p k1=v1,k2=v2

Just make it consistent with the REST API

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the current definition is more friendly to cli.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked the Kubernetes style

kubectl get pods -l app=nginx,environment=production

broker.conf
```properties
# Enables watching topic add/remove events on broker side. It is separated from enableBrokerSideSubscriptionPatternEvaluation.
enableBrokerTopicListWatcher = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How this configuration will be used? Here defined the configuration name, but there is no detailed behavior definition for this configuration.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of Scope

Not support topic list watching for customized topic listing in this PIP. It can be considered in future work.
If you want to use this feature, you need to disable topic list watcher by set enableBrokerTopicListWatcher = false.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so can we remove all the related information for enableBrokerTopicListWatcher? I mean, after we supported topic list watching for customized topic listing, this configuration will be useless?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's required to be added, please help provide more information about how this configuration works. I'm not pretty clear about this part.

@coderzc
Copy link
Member Author

coderzc commented Jan 30, 2026

After discussions with @codelipenghui and @BewareMyPower, we found that the current working method of BrokerInterceptor cannot accurately specify which result to use when multiple BrokerInterceptors are configured. Therefore, a new pluggable interface PulsarResourcesExtended has been introduced to implement this feature.

PulsarResourcesExtended is defined as a general interface used as an extension for customized PulsarResources

@coderzc coderzc force-pushed the pip-452 branch 2 times, most recently from 28a5562 to a835edd Compare January 30, 2026 12:41
Clarified the description of the 'properties' parameter in the listTopicOfNamespace method.
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. PIP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants