You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "nodece (via GitHub)" <gi...@apache.org> on 2023/12/13 04:39:14 UTC
Re: [PR] [improve][pip] PIP-300: Add custom dynamic configuration for plugins [pulsar]
nodece commented on code in PR #21127:
URL: https://github.com/apache/pulsar/pull/21127#discussion_r1424838387
##########
pip/pip-300.md:
##########
@@ -0,0 +1,73 @@
+# Motivation
+
+Dynamic configuration is an important feature in the production environment, the Pulsar supports this feature,
+see `ServiceConfiguration.java`, when the field has `@FieldContext(dynamic = true)` means it is a dynamic configuration,
+and then we can use the `pulsar-admin` to update this field.
+
+The Pulsar has multiple pluggable plugins like authentication provider, authorization provider, and so on. In the
+plugin, we can get the Pulsar configurations and customized configurations, in some scenarios, we need to use
+the `pulsar-admin` to change the values of customized configuration, but the Pulsar doesn't support this operation.
+
+# Goals
+
+## In Scope
+
+The goal of this PIP is to allow the `pulsar-admin` to update the values of customized configuration.
+
+# Detailed Design
+
+## Design & Implementation Details
+
+The `org.apache.pulsar.broker.service.BrokerService.dynamicConfigurationMap` holds the dynamic configurations, so we
+just to add the configurations that need to be dynamically configured to this map, and then we can use
+the `pulsar-admin` to update the values of these configurations.
+
+Users can only register custom configurations and only once. If multiple registrations are performed, an exception will be thrown.
+
+Add `void registerCustomDynamicConfiguration(String key, Predicate<String> validator)` to the `BrokerService.java`,
+
+```java
+public void registerCustomDynamicConfiguration(String key, Predicate<String> validator) {
+ if (dynamicConfigurationMap.containsKey(key)) {
+ throw new IllegalArgumentException(key + " already exists in the dynamicConfigurationMap");
+ }
+ try {
+ ServiceConfiguration.class.getDeclaredField(key);
+ throw new IllegalArgumentException("Only register custom configuration");
Review Comment:
I accidentally copied the wrong code, this check is meaningless.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org