-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[PIP-105] Part-1 Support add subscription properties #12869
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
Conversation
|
We have a short conversation for this PR, provide the context here.
|
Jason918
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we make the type of property value Long? Isn't String more extendable?
|
|
||
| optional KeySharedMeta keySharedMeta = 17; | ||
|
|
||
| repeated KeyLongValue subscription_properties = 18; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be optional ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repeated already contains optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know, Thx~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be KeyValue? If use KeyLongValue, we can only use uint64 for the value.
# Conflicts: # pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
|
|
||
| optional KeySharedMeta keySharedMeta = 17; | ||
|
|
||
| repeated KeyLongValue subscription_properties = 18; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be KeyValue? If use KeyLongValue, we can only use uint64 for the value.
pulsar-common/src/main/java/org/apache/pulsar/common/protocol/Commands.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SubscriptionOption.java
Outdated
Show resolved
Hide resolved
| * @param option | ||
| * @return | ||
| */ | ||
| CompletableFuture<Consumer> subscribe(SubscriptionOption option); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we can remove the old one to avoid interface complexity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleting the interface is not good, I first set it to @deprecated
| this.fullName = MoreObjects.toStringHelper(this).add("topic", topicName).add("name", subName).toString(); | ||
| this.expiryMonitor = new PersistentMessageExpiryMonitor(topicName, subscriptionName, cursor, this); | ||
| this.setReplicated(replicated); | ||
| this.subscriptionProperties = subscriptionProperties == null ? new HashMap<>() : subscriptionProperties; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| this.subscriptionProperties = subscriptionProperties == null ? new HashMap<>() : subscriptionProperties; | |
| this.subscriptionProperties = subscriptionProperties == null ? Collections.emptyMap() : Collections.unmodifiableMap(subscriptionProperties); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collections.emptyMap() is a static Map, and data may be put into this Map, so I think it is better to new
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java
Outdated
Show resolved
Hide resolved
…umerBuilderImpl.java Co-authored-by: lipenghui <penghui@apache.org>
…Commands.java Co-authored-by: lipenghui <penghui@apache.org>
|
@315157973 In topics stats, Do we need to display subscription properties information? When the user sets the sub properties, how do we view the sub properties set by the user? |
| } | ||
|
|
||
| @Override | ||
| public CompletableFuture<Consumer> subscribe(final TransportCnx cnx, String subscriptionName, long consumerId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface has been marked as Deprecated, we'd better change it to private CompletableFuture<Consumer> internalSubscribe and delete @Override to avoid confusing.
| void recordAddLatency(long latency, TimeUnit unit); | ||
|
|
||
| @Deprecated | ||
| CompletableFuture<Consumer> subscribe(TransportCnx cnx, String subscriptionName, long consumerId, SubType subType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of tests called this interface, and in order to delete it in the future, should we change the test to call the new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will open another PR to do this
| assertEquals(properties4.get("3"), "3"); | ||
| assertEquals(properties4.get("4"), "4"); | ||
| consumer4.close(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- add the case: consumer subscribe without subscriptionProperties set, it will get the old one. And then restart broker, it won't get any properties?
- restart broker and create a new consumer with new properties, the properties will be updated. Do not restart broker and create a new consumer with new properties, the properties will be ignored. Whether the broker restart or not will not be known for consumer, does this action will confuse the consumer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit test has been added
The configuration of the Consumer is usually the same. Even if the Broker restarts and the Consumer reconnects with the original configuration, the Properties will be restored.
There are still many things to do in the future, and different PRs will be split |
hangc0276
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job.
Signed-off-by: xiaolongran <xiaolongran@tencent.com> ### Motivation In #12869 , we introduce new filed `subscriptionProperties` in `CommandSubsctibe`. In order to better query the subscriptionProperties set by the user, we will display this property in SubscribeStats ### Modifications - Add subscription properties for SubscriptionStats - add test case
Signed-off-by: xiaolongran <xiaolongran@tencent.com> ### Motivation In apache/pulsar#12869, we introduce pluggable entry filter in Dispatcher, the pull request is the Go SDK implementation of this PIP ### Modifications *Describe the modifications you've done.* - Add subscription properties for ConsumerOptions - Update `pulsarApi.proto` file
### Motivation See apache#12269 I divided this PIP into two parts, the first part supports setting properties for subscriptions The second part will support plug-in loading, filtering, etc. ### Modifications Support add subscription properties
Signed-off-by: xiaolongran <xiaolongran@tencent.com> ### Motivation In apache#12869 , we introduce new filed `subscriptionProperties` in `CommandSubsctibe`. In order to better query the subscriptionProperties set by the user, we will display this property in SubscribeStats ### Modifications - Add subscription properties for SubscriptionStats - add test case
### Motivation See apache#12269 I divided this PIP into two parts, the first part supports setting properties for subscriptions The second part will support plug-in loading, filtering, etc. ### Modifications Support add subscription properties
Signed-off-by: xiaolongran <xiaolongran@tencent.com> ### Motivation In apache#12869 , we introduce new filed `subscriptionProperties` in `CommandSubsctibe`. In order to better query the subscriptionProperties set by the user, we will display this property in SubscribeStats ### Modifications - Add subscription properties for SubscriptionStats - add test case
Motivation
See #12269
I divided this PIP into two parts, the first part supports setting properties for subscriptions
The second part will support plug-in loading, filtering, etc.
Modifications
Support add subscription properties
Documentation
doc-required