Support for long polling timeout parameters, add maximum retry custom Settin, and add listener switches at configuration time
@@ -25,6 +25,10 @@ import static com.alibaba.nacos.api.PropertyKeyConst.ENDPOINT_PORT;
import static com.alibaba.nacos.api.PropertyKeyConst.NAMESPACE;
import static com.alibaba.nacos.api.PropertyKeyConst.SECRET_KEY;
import static com.alibaba.nacos.api.PropertyKeyConst.SERVER_ADDR;
+import static com.alibaba.nacos.api.PropertyKeyConst.MAX_RETRY;
+import static com.alibaba.nacos.api.PropertyKeyConst.CONFIG_LONG_POLL_TIMEOUT;
+import static com.alibaba.nacos.api.PropertyKeyConst.CONFIG_RETRY_TIME;
+import static com.alibaba.nacos.api.PropertyKeyConst.ENABLE_REMOTE_SYNC_CONFIG;
import java.util.List;
import java.util.Objects;
@@ -81,6 +85,26 @@ public class NacosConfigProperties {
*/
private int timeout = 3000;
+ /**
+ * nacos maximum number of tolerable server reconnection errors
+ */
+ private String maxRetry;
+
+ /**
+ * nacos get config long poll timeout
+ */
+ private String configLongPollTimeout;
+
+ /**
+ * nacos get config failure retry time
+ */
+ private String configRetryTime;
+
+ /**
+ * nacos enable add a listener when the configuration is obtained
+ */
+ private boolean enableRemoteSyncConfig = false;
+
/**
* endpoint for Nacos, the domain name of a service, through which the server address
* can be dynamically obtained.
@@ -177,6 +201,38 @@ public class NacosConfigProperties {
this.timeout = timeout;
}
+ public String getMaxRetry() {
+ return maxRetry;
+ }
+
+ public void setMaxRetry(String maxRetry) {
+ this.maxRetry = maxRetry;
+ }
+
+ public String getConfigLongPollTimeout() {
+ return configLongPollTimeout;
+ }
+
+ public void setConfigLongPollTimeout(String configLongPollTimeout) {
+ this.configLongPollTimeout = configLongPollTimeout;
+ }
+
+ public String getConfigRetryTime() {
+ return configRetryTime;
+ }
+
+ public void setConfigRetryTime(String configRetryTime) {
+ this.configRetryTime = configRetryTime;
+ }
+
+ public Boolean getEnableRemoteSyncConfig() {
+ return enableRemoteSyncConfig;
+ }
+
+ public void setEnableRemoteSyncConfig(Boolean enableRemoteSyncConfig) {
+ this.enableRemoteSyncConfig = enableRemoteSyncConfig;
+ }
+
public String getEndpoint() {
return endpoint;
}
@@ -331,6 +387,10 @@ public class NacosConfigProperties {
properties.put(SECRET_KEY, Objects.toString(this.secretKey, ""));
properties.put(CONTEXT_PATH, Objects.toString(this.contextPath, ""));
properties.put(CLUSTER_NAME, Objects.toString(this.clusterName, ""));
+ properties.put(MAX_RETRY, Objects.toString(this.maxRetry, ""));
+ properties.put(CONFIG_LONG_POLL_TIMEOUT, Objects.toString(this.configLongPollTimeout, ""));
+ properties.put(CONFIG_RETRY_TIME, Objects.toString(this.configRetryTime, ""));
+ properties.put(ENABLE_REMOTE_SYNC_CONFIG, Objects.toString(this.enableRemoteSyncConfig, ""));
String endpoint = Objects.toString(this.endpoint, "");
if (endpoint.contains(":")) {
