-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[feat][broker] PIP-452: Customizable topic listing of namespace with properties #25160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
599da94
Implement PIP-452
coderzc 07f2828
Add TopicListingResult class
coderzc 1daa7ee
fix test
coderzc 9ec948d
Refactor CustomizedTopicListingInterceptor to CustomizedPulsarResourc…
coderzc 70ea1c8
Refactor Pulsar service integration in CustomizedPulsarResourcesExten…
coderzc a5383ac
Remove unused 'properties' query parameter from non-persistent topics…
coderzc a0549c0
re-trigger test
coderzc f8a71ee
fix
coderzc e2e7364
fix test
coderzc 526f10b
remove unused code
coderzc 0f76386
fix test
coderzc 8701a63
update doc for enableBrokerSideSubscriptionPatternEvaluation config
coderzc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
pulsar-broker/src/main/java/org/apache/pulsar/broker/DefaultPulsarResourcesExtended.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.pulsar.broker; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.concurrent.CompletableFuture; | ||
| import lombok.Getter; | ||
| import org.apache.pulsar.broker.namespace.NamespaceService; | ||
| import org.apache.pulsar.common.api.proto.CommandGetTopicsOfNamespace; | ||
| import org.apache.pulsar.common.naming.NamespaceName; | ||
|
|
||
| /** | ||
| * Default implementation of {@link PulsarResourcesExtended}. | ||
| * | ||
| * <p>This implementation provides the standard topic listing functionality | ||
| * by delegating to the {@link NamespaceService}.</p> | ||
| */ | ||
| public class DefaultPulsarResourcesExtended implements PulsarResourcesExtended { | ||
|
|
||
| @Getter | ||
| private PulsarService pulsarService; | ||
|
|
||
| @Override | ||
| public CompletableFuture<List<String>> listTopicOfNamespace(NamespaceName namespaceName, | ||
| CommandGetTopicsOfNamespace.Mode mode, | ||
| Map<String, String> properties) { | ||
| return pulsarService.getNamespaceService().getListOfTopics(namespaceName, mode); | ||
| } | ||
|
|
||
| @Override | ||
| public void initialize(PulsarService pulsarService) { | ||
| this.pulsarService = pulsarService; | ||
| } | ||
|
|
||
| @Override | ||
| public void close() { | ||
| // No specific resources to close in the default implementation | ||
| } | ||
| } |
73 changes: 73 additions & 0 deletions
73
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarResourcesExtended.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.pulsar.broker; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.concurrent.CompletableFuture; | ||
| import org.apache.pulsar.common.api.proto.CommandGetTopicsOfNamespace; | ||
| import org.apache.pulsar.common.classification.InterfaceStability; | ||
| import org.apache.pulsar.common.naming.NamespaceName; | ||
| import org.jspecify.annotations.Nullable; | ||
|
|
||
| /** | ||
| * Extended PulsarResources that provides additional functionality beyond PulsarResources. | ||
| * | ||
| * <p>This interface is designed to be pluggable, allowing custom implementations | ||
| * to provide extended PulsarResources capabilities such as custom topic listing strategies</p> | ||
| * | ||
| * <p>Implementations of this interface can be registered with PulsarService to | ||
| * provide extended resource management capabilities.</p> | ||
| */ | ||
| @InterfaceStability.Evolving | ||
| public interface PulsarResourcesExtended { | ||
|
|
||
| /** | ||
| * Lists topics in a namespace with optional property-based filtering. | ||
| * | ||
| * <p>This method provides a flexible way to list topics in a namespace, | ||
| * supporting property-based filtering through the properties parameter.</p> | ||
| * | ||
| * @param namespaceName the namespace to list topics from | ||
| * @param mode the listing mode (ALL, PERSISTENT, NON_PERSISTENT) | ||
| * @param properties optional property filters for topic listing, if null or empty, no filtering is applied | ||
| * @return a CompletableFuture containing the list of topic names | ||
| */ | ||
| CompletableFuture<List<String>> listTopicOfNamespace(NamespaceName namespaceName, | ||
| CommandGetTopicsOfNamespace.Mode mode, | ||
| @Nullable Map<String, String> properties); | ||
|
|
||
| /** | ||
| * Initializes this extended resources instance with the PulsarService. | ||
| * | ||
| * <p>This method is called during broker startup to provide the implementation | ||
| * with access to the PulsarService and its dependencies.</p> | ||
| * | ||
| * @param pulsarService the PulsarService instance | ||
| */ | ||
| void initialize(PulsarService pulsarService); | ||
|
|
||
| /** | ||
| * Closes this extended resources instance and releases any resources. | ||
| * | ||
| * <p>This method should be called during broker shutdown to clean up | ||
| * any resources held by the implementation.</p> | ||
| */ | ||
| void close(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.