This commit is contained in:
parent
e155591adb
commit
647f58a02b
|
|
@ -68,7 +68,6 @@ import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_FAILE
|
|||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_REFLECTIVE_OPERATION_FAILED;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_UNEXPECTED_EXCEPTION;
|
||||
import static org.apache.dubbo.common.utils.ClassUtils.isSimpleType;
|
||||
import static org.apache.dubbo.common.utils.ReflectUtils.findMethodByMethodSignature;
|
||||
import static org.apache.dubbo.config.Constants.PARAMETERS;
|
||||
|
||||
/**
|
||||
|
|
@ -76,11 +75,13 @@ import static org.apache.dubbo.config.Constants.PARAMETERS;
|
|||
*
|
||||
* @export
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public abstract class AbstractConfig implements Serializable {
|
||||
|
||||
protected static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(AbstractConfig.class);
|
||||
private static final long serialVersionUID = 4267533505537413570L;
|
||||
|
||||
protected static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(AbstractConfig.class);
|
||||
|
||||
/**
|
||||
* tag name cache, speed up get tag name frequently
|
||||
*/
|
||||
|
|
@ -97,19 +98,22 @@ public abstract class AbstractConfig implements Serializable {
|
|||
private static final String[] SUFFIXES = new String[]{"Config", "Bean", "ConfigBase"};
|
||||
|
||||
/**
|
||||
* The config id
|
||||
* Identifier for this configuration.
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* Indicates whether the configuration has been refreshed (true if refreshed).
|
||||
*/
|
||||
protected final AtomicBoolean refreshed = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
* Indicate that if current config needs to being refreshed, default is true
|
||||
* Specifies if this configuration should be refreshed (true for refreshing).
|
||||
*/
|
||||
protected transient volatile boolean needRefresh = true;
|
||||
|
||||
/**
|
||||
* Is default config or not
|
||||
* Indicates if this is the default configuration (true for default).
|
||||
*/
|
||||
protected Boolean isDefault;
|
||||
|
||||
|
|
@ -158,16 +162,12 @@ public abstract class AbstractConfig implements Serializable {
|
|||
appendParameters(parameters, config, null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void appendParameters(Map<String, String> parameters, Object config, String prefix) {
|
||||
appendParameters0(parameters, config, prefix, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put attributes of specify 'config' into 'parameters' argument
|
||||
*
|
||||
* @param parameters
|
||||
* @param config
|
||||
*/
|
||||
public static void appendAttributes(Map<String, String> parameters, Object config) {
|
||||
appendParameters0(parameters, config, null, false);
|
||||
|
|
@ -292,7 +292,7 @@ public abstract class AbstractConfig implements Serializable {
|
|||
|
||||
private static void invokeSetParameters(Class c, Object o, Map map) {
|
||||
try {
|
||||
Method method = findMethodByMethodSignature(c, "setParameters", new String[]{Map.class.getName()});
|
||||
Method method = ReflectUtils.findMethodByMethodSignature(c, "setParameters", new String[]{Map.class.getName()});
|
||||
if (method != null && isParametersSetter(method)) {
|
||||
method.invoke(o, map);
|
||||
}
|
||||
|
|
@ -304,7 +304,7 @@ public abstract class AbstractConfig implements Serializable {
|
|||
private static Map<String, String> invokeGetParameters(Class c, Object o) {
|
||||
try {
|
||||
|
||||
Method method = findMethodByMethodSignature(c, "getParameters", null);
|
||||
Method method = ReflectUtils.findMethodByMethodSignature(c, "getParameters", null);
|
||||
if (method != null && isParametersGetter(method)) {
|
||||
return (Map<String, String>) method.invoke(o);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,9 +58,8 @@ import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_NO_ME
|
|||
import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMETHEUS;
|
||||
import static org.apache.dubbo.config.Constants.DEFAULT_NATIVE_PROXY;
|
||||
|
||||
|
||||
/**
|
||||
* AbstractDefaultConfig
|
||||
* Abstract configuration for the interface.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
|
|
@ -69,134 +68,148 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
|
|||
private static final long serialVersionUID = -1559314110797223229L;
|
||||
|
||||
/**
|
||||
* The interface name of the exported service
|
||||
* Interface name of the exported service.
|
||||
*/
|
||||
protected String interfaceName;
|
||||
|
||||
/**
|
||||
* The classLoader of interface belong to
|
||||
* ClassLoader associated with the interface.
|
||||
*/
|
||||
protected transient ClassLoader interfaceClassLoader;
|
||||
|
||||
/**
|
||||
* The remote service version the customer/provider side will reference
|
||||
* Version of the remote service referenced by the consumer/provider.
|
||||
*/
|
||||
protected String version;
|
||||
|
||||
/**
|
||||
* The remote service group the customer/provider side will reference
|
||||
* Group of the remote service referenced by the consumer/provider.
|
||||
*/
|
||||
protected String group;
|
||||
|
||||
protected ServiceMetadata serviceMetadata;
|
||||
/**
|
||||
* Local impl class name for the service interface
|
||||
* Service metadata configuration.
|
||||
*/
|
||||
protected ServiceMetadata serviceMetadata;
|
||||
|
||||
/**
|
||||
* Local implementation class name for the service interface.
|
||||
*/
|
||||
protected String local;
|
||||
|
||||
/**
|
||||
* Local stub class name for the service interface
|
||||
* Local stub class name for the service interface.
|
||||
*/
|
||||
protected String stub;
|
||||
|
||||
/**
|
||||
* Service monitor
|
||||
* Service monitoring configuration.
|
||||
*/
|
||||
protected MonitorConfig monitor;
|
||||
|
||||
/**
|
||||
* Strategies for generating dynamic agents,there are two strategies can be chosen: jdk and javassist
|
||||
* Strategy for generating dynamic agents (options: "jdk" or "javassist").
|
||||
*/
|
||||
protected String proxy;
|
||||
|
||||
/**
|
||||
* Cluster type
|
||||
* Cluster type for service.
|
||||
*/
|
||||
protected String cluster;
|
||||
|
||||
/**
|
||||
* The {@code Filter} when the provider side exposed a service or the customer side references a remote service used,
|
||||
* if there are more than one, you can use commas to separate them
|
||||
* Filters for service exposure or reference (multiple filters can be separated by commas).
|
||||
*/
|
||||
protected String filter;
|
||||
|
||||
/**
|
||||
* The Listener when the provider side exposes a service or the customer side references a remote service used
|
||||
* if there are more than one, you can use commas to separate them
|
||||
* Listeners for service exposure or reference (multiple listeners can be separated by commas).
|
||||
*/
|
||||
protected String listener;
|
||||
|
||||
/**
|
||||
* The owner of the service providers
|
||||
* Owner of the service providers.
|
||||
*/
|
||||
protected String owner;
|
||||
|
||||
/**
|
||||
* Connection limits, 0 means shared connection, otherwise it defines the connections delegated to the current service
|
||||
* Connection limits: 0 for shared connection, otherwise specifying connections for the service.
|
||||
*/
|
||||
protected Integer connections;
|
||||
|
||||
/**
|
||||
* The layer of service providers
|
||||
* Layer of service providers.
|
||||
*/
|
||||
protected String layer;
|
||||
|
||||
/**
|
||||
* The application info
|
||||
* Application configuration for the service.
|
||||
*/
|
||||
protected ApplicationConfig application;
|
||||
|
||||
/**
|
||||
* The module info
|
||||
* Module configuration for the service.
|
||||
*/
|
||||
protected ModuleConfig module;
|
||||
|
||||
/**
|
||||
* The registry list the service will register to
|
||||
* Also see {@link #registryIds}, only one of them will work.
|
||||
* Registries where the service will be registered (use this or registryIds, not both).
|
||||
*/
|
||||
protected List<RegistryConfig> registries;
|
||||
|
||||
/**
|
||||
* The method configuration
|
||||
* Method-specific configuration.
|
||||
*/
|
||||
private List<MethodConfig> methods;
|
||||
|
||||
/**
|
||||
* The id list of registries the service will register to
|
||||
* Also see {@link #registries}, only one of them will work.
|
||||
* Registry IDs for service registration (use this or registries, not both).
|
||||
*/
|
||||
protected String registryIds;
|
||||
|
||||
// connection events
|
||||
/**
|
||||
* Event handler for connection establishment.
|
||||
*/
|
||||
protected String onconnect;
|
||||
|
||||
/**
|
||||
* Disconnection events
|
||||
* Event handler for disconnection.
|
||||
*/
|
||||
protected String ondisconnect;
|
||||
|
||||
/**
|
||||
* The metadata report configuration
|
||||
* Metadata report configuration.
|
||||
*/
|
||||
protected MetadataReportConfig metadataReportConfig;
|
||||
|
||||
/**
|
||||
* Configuration center settings.
|
||||
*/
|
||||
protected ConfigCenterConfig configCenter;
|
||||
|
||||
// callback limits
|
||||
/**
|
||||
* Callback limits for the service.
|
||||
*/
|
||||
private Integer callbacks;
|
||||
// the scope for referring/exporting a service, if it's local, it means searching in current JVM only.
|
||||
|
||||
/**
|
||||
* Service scope ("local" implies searching in the current JVM only).
|
||||
*/
|
||||
private String scope;
|
||||
|
||||
/**
|
||||
* Custom tag for the service configuration.
|
||||
*/
|
||||
protected String tag;
|
||||
|
||||
/**
|
||||
* Enable service authentication.
|
||||
*/
|
||||
private Boolean auth;
|
||||
|
||||
/*Indicates to create separate instances or not for services/references that have the same serviceKey.
|
||||
* By default, all services/references that have the same serviceKey will share the same instance and process.
|
||||
*
|
||||
* This key currently can only work when using ReferenceConfig and SimpleReferenceCache together.
|
||||
* Call ReferenceConfig.get() directly will not check this attribute.
|
||||
/**
|
||||
* Use separate instances for services with the same serviceKey (applies when using ReferenceConfig and SimpleReferenceCache together).
|
||||
* Directly calling ReferenceConfig.get() will not check this attribute.
|
||||
*/
|
||||
private Boolean singleton;
|
||||
|
||||
|
|
@ -733,7 +746,6 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
|
|||
this.registryIds = registryIds;
|
||||
}
|
||||
|
||||
|
||||
public List<MethodConfig> getMethods() {
|
||||
return methods;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* AbstractMethodConfig
|
||||
* Abstract configuration for the method.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
|
|
@ -37,73 +37,67 @@ public abstract class AbstractMethodConfig extends AbstractConfig {
|
|||
private static final long serialVersionUID = 5809761483000878437L;
|
||||
|
||||
/**
|
||||
* The timeout for remote invocation in milliseconds
|
||||
* Timeout for remote invocation in milliseconds.
|
||||
*/
|
||||
protected Integer timeout;
|
||||
|
||||
/**
|
||||
* The retry times
|
||||
* Retry times for failed invocations.
|
||||
*/
|
||||
protected Integer retries;
|
||||
|
||||
/**
|
||||
* max concurrent invocations
|
||||
* Maximum concurrent invocations allowed.
|
||||
*/
|
||||
protected Integer actives;
|
||||
|
||||
/**
|
||||
* The load balance
|
||||
* Load balancing strategy for service invocation.
|
||||
*/
|
||||
protected String loadbalance;
|
||||
|
||||
/**
|
||||
* Whether to async
|
||||
* note that: it is an unreliable asynchronous that ignores return values and does not block threads.
|
||||
* Enable asynchronous invocation. Note that it is unreliable asynchronous, ignoring return values and not blocking threads.
|
||||
*/
|
||||
protected Boolean async;
|
||||
|
||||
/**
|
||||
* Whether to ack async-sent
|
||||
* Acknowledge asynchronous-sent invocations.
|
||||
*/
|
||||
protected Boolean sent;
|
||||
|
||||
/**
|
||||
* The name of mock class which gets called when a service fails to execute
|
||||
* <p>
|
||||
* note that: the mock doesn't support on the provider side,and the mock is executed when a non-business exception
|
||||
* occurs after a remote service call
|
||||
* Mock class name to be called when a service fails to execute. The mock doesn't support on the provider side,
|
||||
* and it is executed when a non-business exception occurs after a remote service call.
|
||||
*/
|
||||
protected String mock;
|
||||
|
||||
/**
|
||||
* Merger
|
||||
* Merger for result data.
|
||||
*/
|
||||
protected String merger;
|
||||
|
||||
/**
|
||||
* Cache the return result with the call parameter as key, the following options are available: lru, threadlocal,
|
||||
* jcache, etc.
|
||||
* Cache provider for caching return results. available options: lru, threadlocal, jcache etc.
|
||||
*/
|
||||
protected String cache;
|
||||
|
||||
/**
|
||||
* Whether JSR303 standard annotation validation is enabled or not, if enabled, annotations on method parameters will
|
||||
* be validated
|
||||
* Enable JSR303 standard annotation validation for method parameters.
|
||||
*/
|
||||
protected String validation;
|
||||
|
||||
/**
|
||||
* The customized parameters
|
||||
* Customized parameters for configuration.
|
||||
*/
|
||||
protected Map<String, String> parameters;
|
||||
|
||||
/**
|
||||
* Forks for forking cluster
|
||||
* Forks for forking cluster.
|
||||
*/
|
||||
protected Integer forks;
|
||||
|
||||
public AbstractMethodConfig() {
|
||||
|
||||
}
|
||||
|
||||
public AbstractMethodConfig(ModuleModel moduleModel) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.SERVICE_EXECUTOR
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.SERVICE_FILTER_KEY;
|
||||
|
||||
/**
|
||||
* AbstractServiceConfig
|
||||
* Abstract configuration for the service.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
|
|
@ -42,100 +42,98 @@ public abstract class AbstractServiceConfig extends AbstractInterfaceConfig {
|
|||
private static final long serialVersionUID = -9026290350363878309L;
|
||||
|
||||
/**
|
||||
* The service version
|
||||
* The service version.
|
||||
*/
|
||||
protected String version;
|
||||
|
||||
/**
|
||||
* The service group
|
||||
* The service group.
|
||||
*/
|
||||
protected String group;
|
||||
|
||||
/**
|
||||
* whether the service is deprecated
|
||||
* Whether the service is deprecated.
|
||||
*/
|
||||
protected Boolean deprecated; // false;
|
||||
protected Boolean deprecated;
|
||||
|
||||
/**
|
||||
* The time delay register service (milliseconds)
|
||||
* The time delay to register the service (in milliseconds).
|
||||
*/
|
||||
protected Integer delay;
|
||||
|
||||
/**
|
||||
* Whether to export the service
|
||||
* Whether to export the service.
|
||||
*/
|
||||
protected Boolean export;
|
||||
|
||||
/**
|
||||
* The service weight
|
||||
* The service weight.
|
||||
*/
|
||||
protected Integer weight;
|
||||
|
||||
/**
|
||||
* Document center
|
||||
* Document center for the service.
|
||||
*/
|
||||
protected String document;
|
||||
|
||||
/**
|
||||
* Whether to register as a dynamic service or not on register center, the value is true, the status will be enabled
|
||||
* after the service registered,and it needs to be disabled manually; if you want to disable the service, you also need
|
||||
* manual processing
|
||||
* Whether to register the service as a dynamic service on the registry. If true, the service
|
||||
* will be enabled automatically after registration, and manual disabling is required to stop it.
|
||||
*/
|
||||
protected Boolean dynamic; // true;
|
||||
protected Boolean dynamic;
|
||||
|
||||
/**
|
||||
* Whether to use token
|
||||
* Whether to use a token for authentication.
|
||||
*/
|
||||
protected String token;
|
||||
|
||||
/**
|
||||
* Whether to export access logs to logs
|
||||
* Whether to export access logs to logs.
|
||||
*/
|
||||
protected String accesslog;
|
||||
|
||||
/**
|
||||
* The protocol list the service will export with
|
||||
* Also see {@link #protocolIds}, only one of them will work.
|
||||
* List of protocols the service will export with (use this or protocolIds, not both).
|
||||
*/
|
||||
protected List<ProtocolConfig> protocols;
|
||||
|
||||
/**
|
||||
* The id list of protocols the service will export with
|
||||
* Also see {@link #protocols}, only one of them will work.
|
||||
* Id list of protocols the service will export with (use this or protocols, not both).
|
||||
*/
|
||||
protected String protocolIds;
|
||||
|
||||
/**
|
||||
* Max allowed executing times
|
||||
* Max allowed executing times.
|
||||
*/
|
||||
private Integer executes;
|
||||
|
||||
/**
|
||||
* Whether to register
|
||||
* Whether to register the service.
|
||||
*/
|
||||
private Boolean register;
|
||||
|
||||
/**
|
||||
* Warm up period
|
||||
* Warm-up period for the service.
|
||||
*/
|
||||
private Integer warmup;
|
||||
|
||||
/**
|
||||
* The serialization type
|
||||
* Serialization type for service communication.
|
||||
*/
|
||||
private String serialization;
|
||||
|
||||
/**
|
||||
* If the parameter has a value, the consumer will read the parameter first.
|
||||
* Specifies the preferred serialization method for the consumer.
|
||||
* If specified, the consumer will use this parameter first.
|
||||
* If the Dubbo Sdk you are using contains the serialization type, the serialization method specified by the argument is used.
|
||||
* <p>
|
||||
* When this parameter is null or the serialization type specified by this parameter does not exist in the Dubbo SDK, the serialization type specified by serialization is used.
|
||||
* If the Dubbo SDK if still does not exist, the default type of the Dubbo SDK is used.
|
||||
* For Dubbo SDK >= 3.2, <code>preferSerialization</code> takes precedence over <code>serialization</code>
|
||||
* <p>
|
||||
* The configuration supports multiple, which are separated by commas.Such as:<code>fastjson2,fastjson,hessian2</code>
|
||||
* Supports multiple values separated by commas, e.g., "fastjson2,fastjson,hessian2".
|
||||
*/
|
||||
private String preferSerialization; // default:fastjson2,hessian2
|
||||
private String preferSerialization; // Default: fastjson2, hessian2
|
||||
|
||||
/**
|
||||
* Weather the service is export asynchronously
|
||||
|
|
|
|||
|
|
@ -75,188 +75,225 @@ import static org.apache.dubbo.config.Constants.PRODUCTION_ENVIRONMENT;
|
|||
import static org.apache.dubbo.config.Constants.TEST_ENVIRONMENT;
|
||||
|
||||
/**
|
||||
* The application info
|
||||
* Configuration for the dubbo application.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
public class ApplicationConfig extends AbstractConfig {
|
||||
private static final ErrorTypeAwareLogger LOGGER = LoggerFactory.getErrorTypeAwareLogger(ApplicationConfig.class);
|
||||
|
||||
private static final long serialVersionUID = 5508512956753757169L;
|
||||
|
||||
private static final ErrorTypeAwareLogger LOGGER = LoggerFactory.getErrorTypeAwareLogger(ApplicationConfig.class);
|
||||
|
||||
private static final String DEFAULT_NAME_PREFIX = "DUBBO_APP_";
|
||||
|
||||
/**
|
||||
* Application name
|
||||
* The Application name.
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* The application version
|
||||
* The application version.
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* Application owner
|
||||
* The application owner.
|
||||
*/
|
||||
private String owner;
|
||||
|
||||
/**
|
||||
* Application's organization (BU)
|
||||
* The application's organization (BU).
|
||||
*/
|
||||
private String organization;
|
||||
|
||||
/**
|
||||
* Architecture layer
|
||||
* Architecture layer.
|
||||
*/
|
||||
private String architecture;
|
||||
|
||||
/**
|
||||
* Environment, e.g. dev, test or production
|
||||
* Environment, e.g., dev, test, or production.
|
||||
*/
|
||||
private String environment;
|
||||
|
||||
/**
|
||||
* Java compiler
|
||||
* Java compiler.
|
||||
*/
|
||||
private String compiler;
|
||||
|
||||
/**
|
||||
* The type of the log access
|
||||
* The type of log access.
|
||||
*/
|
||||
private String logger;
|
||||
|
||||
/**
|
||||
* Registry centers
|
||||
* Registry centers.
|
||||
*/
|
||||
private List<RegistryConfig> registries;
|
||||
|
||||
/**
|
||||
* The comma-separated list of registry IDs to which the service will be registered.
|
||||
*/
|
||||
private String registryIds;
|
||||
|
||||
/**
|
||||
* Monitor center
|
||||
* Monitor center.
|
||||
*/
|
||||
private MonitorConfig monitor;
|
||||
|
||||
/**
|
||||
* Directory for saving thread dump
|
||||
* Directory for saving thread dump.
|
||||
*/
|
||||
private String dumpDirectory;
|
||||
|
||||
/**
|
||||
* Whether to enable saving thread dump or not
|
||||
* Whether to enable saving thread dump or not.
|
||||
*/
|
||||
private Boolean dumpEnable;
|
||||
|
||||
/**
|
||||
* Whether to enable qos or not
|
||||
* Whether to enable Quality of Service (QoS) or not.
|
||||
*/
|
||||
private Boolean qosEnable;
|
||||
|
||||
/**
|
||||
* Whether qos should start success or not, will check qosEnable first
|
||||
* Whether QoS should start successfully or not, will check qosEnable first.
|
||||
*/
|
||||
private Boolean qosCheck;
|
||||
|
||||
/**
|
||||
* The qos host to listen
|
||||
* The QoS host to listen.
|
||||
*/
|
||||
private String qosHost;
|
||||
|
||||
/**
|
||||
* The qos port to listen
|
||||
* The QoS port to listen.
|
||||
*/
|
||||
private Integer qosPort;
|
||||
|
||||
/**
|
||||
* Should we accept foreign ip or not?
|
||||
* Should we accept foreign IP or not?
|
||||
*/
|
||||
private Boolean qosAcceptForeignIp;
|
||||
|
||||
/**
|
||||
* When we disable accept foreign ip, support specify foreign ip in the whitelist
|
||||
* When we disable accepting foreign IP, support specifying foreign IPs in the whitelist.
|
||||
*/
|
||||
private String qosAcceptForeignIpWhitelist;
|
||||
|
||||
/**
|
||||
* the anonymous(any foreign ip) access permission level, default is NONE, can not access any cmd
|
||||
* The anonymous (any foreign IP) access permission level, default is NONE, which means no access to any command.
|
||||
*/
|
||||
private String qosAnonymousAccessPermissionLevel;
|
||||
|
||||
/**
|
||||
* the anonymous(any foreign ip) allow commands, default is empty, can not access any cmd
|
||||
* The anonymous (any foreign IP) allowed commands, default is empty, which means no access to any command.
|
||||
*/
|
||||
private String qosAnonymousAllowCommands;
|
||||
|
||||
/**
|
||||
* Customized parameters
|
||||
* Customized parameters.
|
||||
*/
|
||||
private Map<String, String> parameters;
|
||||
|
||||
/**
|
||||
* Config the shutdown.wait
|
||||
* Config the shutdown wait.
|
||||
*/
|
||||
private String shutwait;
|
||||
|
||||
/**
|
||||
* Hostname.
|
||||
*/
|
||||
private String hostname;
|
||||
|
||||
/**
|
||||
* Metadata type, local or remote, if choose remote, you need to further specify metadata center.
|
||||
* Metadata type, local or remote. If 'remote' is chosen, you need to specify a metadata center further.
|
||||
*/
|
||||
private String metadataType;
|
||||
|
||||
/**
|
||||
* Used to control whether register instance to registry or not. Set to 'false' only when instance is pure consumer.
|
||||
* Used to control whether to register the instance with the registry or not. Set to 'false' only when the instance is a pure consumer.
|
||||
*/
|
||||
private Boolean registerConsumer;
|
||||
|
||||
/**
|
||||
* Repository.
|
||||
*/
|
||||
private String repository;
|
||||
|
||||
/**
|
||||
* Whether to enable file caching.
|
||||
*/
|
||||
private Boolean enableFileCache;
|
||||
|
||||
/**
|
||||
* The preferred protocol(name) of this application
|
||||
* convenient for places where it's hard to determine which is the preferred protocol
|
||||
* The preferred protocol (name) of this application, convenient for places where it's hard to determine the preferred protocol.
|
||||
*/
|
||||
private String protocol;
|
||||
|
||||
/**
|
||||
* The protocol used for peer-to-peer metadata transmission
|
||||
* The protocol used for peer-to-peer metadata transmission.
|
||||
*/
|
||||
private String metadataServiceProtocol;
|
||||
|
||||
/**
|
||||
* Metadata Service, used in Service Discovery
|
||||
* Metadata Service, used in Service Discovery.
|
||||
*/
|
||||
private Integer metadataServicePort;
|
||||
|
||||
/**
|
||||
* The retry interval of service name mapping
|
||||
* The retry interval of service name mapping.
|
||||
*/
|
||||
private Integer mappingRetryInterval;
|
||||
|
||||
/**
|
||||
* used to set extensions of probe in qos
|
||||
* Used to set extensions of the probe in QoS.
|
||||
*/
|
||||
private String livenessProbe;
|
||||
|
||||
/**
|
||||
* The probe for checking the readiness of the application.
|
||||
*/
|
||||
private String readinessProbe;
|
||||
|
||||
/**
|
||||
* The probe for checking the startup of the application.
|
||||
*/
|
||||
private String startupProbe;
|
||||
|
||||
/**
|
||||
* Register mode.
|
||||
*/
|
||||
private String registerMode;
|
||||
|
||||
/**
|
||||
* Whether to enable protection against empty objects.
|
||||
*/
|
||||
private Boolean enableEmptyProtection;
|
||||
|
||||
/**
|
||||
* The status of class serialization checking.
|
||||
*/
|
||||
private String serializeCheckStatus;
|
||||
|
||||
/**
|
||||
* Whether to automatically trust serialized classes.
|
||||
*/
|
||||
private Boolean autoTrustSerializeClass;
|
||||
|
||||
/**
|
||||
* The trust level for serialized classes.
|
||||
*/
|
||||
private Integer trustSerializeClassLevel;
|
||||
|
||||
/**
|
||||
* Whether to check serializable.
|
||||
*/
|
||||
private Boolean checkSerializable;
|
||||
|
||||
/**
|
||||
* thread pool management: default/isolation
|
||||
* Thread pool management mode: 'default' or 'isolation'.
|
||||
*/
|
||||
private String executorManagementMode;
|
||||
|
||||
|
|
@ -364,7 +401,7 @@ public class ApplicationConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
public void setRegistry(RegistryConfig registry) {
|
||||
List<RegistryConfig> registries = new ArrayList<RegistryConfig>(1);
|
||||
List<RegistryConfig> registries = new ArrayList<>(1);
|
||||
registries.add(registry);
|
||||
this.registries = registries;
|
||||
}
|
||||
|
|
@ -520,7 +557,6 @@ public class ApplicationConfig extends AbstractConfig {
|
|||
/**
|
||||
* The format is the same as the springboot, including: getQosEnableCompatible(), getQosPortCompatible(), getQosAcceptForeignIpCompatible().
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Parameter(key = QOS_ENABLE_COMPATIBLE, excluded = true, attribute = false)
|
||||
public Boolean getQosEnableCompatible() {
|
||||
|
|
@ -691,7 +727,6 @@ public class ApplicationConfig extends AbstractConfig {
|
|||
this.metadataServiceProtocol = metadataServiceProtocol;
|
||||
}
|
||||
|
||||
|
||||
@Parameter(key = LIVENESS_PROBE_KEY)
|
||||
public String getLivenessProbe() {
|
||||
return livenessProbe;
|
||||
|
|
@ -719,7 +754,6 @@ public class ApplicationConfig extends AbstractConfig {
|
|||
this.startupProbe = startupProbe;
|
||||
}
|
||||
|
||||
|
||||
public String getSerializeCheckStatus() {
|
||||
return serializeCheckStatus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,77 +39,99 @@ import static org.apache.dubbo.config.Constants.CONFIG_APP_CONFIGFILE_KEY;
|
|||
import static org.apache.dubbo.config.Constants.ZOOKEEPER_PROTOCOL;
|
||||
|
||||
/**
|
||||
* ConfigCenterConfig
|
||||
* Configuration for the config center.
|
||||
*/
|
||||
public class ConfigCenterConfig extends AbstractConfig {
|
||||
|
||||
private final AtomicBoolean initialized = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
* The protocol used for accessing the config center.
|
||||
*/
|
||||
private String protocol;
|
||||
|
||||
/**
|
||||
* The address (URL or hostname) of the config center server.
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* The port number for the config center server.
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* The config center cluster, it's real meaning may very on different Config Center products.
|
||||
* The config center cluster, its actual meaning may vary depending on the specific config center product.
|
||||
*/
|
||||
private String cluster;
|
||||
|
||||
/**
|
||||
* The namespace of the config center, generally it's used for multi-tenant,
|
||||
* but it's real meaning depends on the actual Config Center you use.
|
||||
* The default value is CommonConstants.DUBBO
|
||||
* The namespace of the config center, generally used for multi-tenancy.
|
||||
* Its actual meaning depends on the specific config center you use. Default value is CommonConstants.DUBBO.
|
||||
*/
|
||||
private String namespace;
|
||||
|
||||
/**
|
||||
* The group of the config center, generally it's used to identify an isolated space for a batch of config items,
|
||||
* but it's real meaning depends on the actual Config Center you use.
|
||||
* The default value is CommonConstants.DUBBO
|
||||
* The group of the config center, often used to identify an isolated space for a batch of config items.
|
||||
* Its actual meaning depends on the specific config center you use. Default value is CommonConstants.DUBBO.
|
||||
*/
|
||||
private String group;
|
||||
|
||||
/**
|
||||
* Username for authentication with the config center.
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* Password for authentication with the config center.
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* The default value is 30000L;
|
||||
* The timeout for accessing the config center. Default value is 30000L.
|
||||
*/
|
||||
private Long timeout;
|
||||
|
||||
/**
|
||||
* If the Config Center is given the highest priority, it will override all the other configurations
|
||||
* The default value is true
|
||||
* @deprecated no longer used
|
||||
* If the config center should have the highest priority and override all other configurations.
|
||||
* Deprecated and no longer used. Default value is true.
|
||||
*/
|
||||
private Boolean highestPriority;
|
||||
|
||||
/**
|
||||
* Decide the behaviour when initial connection try fails, 'true' means interrupt the whole process once fail.
|
||||
* The default value is true
|
||||
* Behavior when the initial connection attempt to the config center fails.
|
||||
* 'true' means interrupt the whole process once a failure occurs. Default value is true.
|
||||
*/
|
||||
private Boolean check;
|
||||
|
||||
/**
|
||||
* Used to specify the key that your properties file mapping to, most of the time you do not need to change this parameter.
|
||||
* Notice that for Apollo, this parameter is meaningless, set the 'namespace' is enough.
|
||||
* The default value is CommonConstants.DEFAULT_DUBBO_PROPERTIES
|
||||
* Key mapping for properties files. Most of the time, you do not need to change this parameter.
|
||||
* Default value is CommonConstants.DEFAULT_DUBBO_PROPERTIES.
|
||||
*/
|
||||
private String configFile;
|
||||
|
||||
/**
|
||||
* the properties file under 'configFile' is global shared while .properties under this one is limited only to this application
|
||||
* The properties file under 'configFile' is global shared, while '.properties' under this one is limited only to this application.
|
||||
*/
|
||||
private String appConfigFile;
|
||||
|
||||
/**
|
||||
* If the Config Center product you use have some special parameters that is not covered by this class, you can add it to here.
|
||||
* Additional parameters specific to your config center product can be added here.
|
||||
* For example, with XML:
|
||||
* <dubbo:config-center>
|
||||
* <dubbo:parameter key="{your key}" value="{your value}" />
|
||||
* </dubbo:config-center>
|
||||
* <dubbo:config-center>
|
||||
* <dubbo:parameter key="{your key}" value="{your value}" />
|
||||
* </dubbo:config-center>
|
||||
*/
|
||||
private Map<String, String> parameters;
|
||||
|
||||
/**
|
||||
* External configuration for the config center.
|
||||
*/
|
||||
private Map<String, String> externalConfiguration;
|
||||
|
||||
/**
|
||||
* Application-specific external configuration for the config center.
|
||||
*/
|
||||
private Map<String, String> appExternalConfiguration;
|
||||
|
||||
public ConfigCenterConfig() {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import static org.apache.dubbo.common.utils.PojoUtils.updatePropertyIfAbsent;
|
|||
import static org.apache.dubbo.common.utils.StringUtils.isEmpty;
|
||||
|
||||
/**
|
||||
* MetadataReportConfig
|
||||
* Configuration for the metadata report.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
|
|
@ -47,80 +47,95 @@ public class MetadataReportConfig extends AbstractConfig {
|
|||
|
||||
private static final long serialVersionUID = 55233L;
|
||||
|
||||
/**
|
||||
* The protocol for the metadata center.
|
||||
*/
|
||||
private String protocol;
|
||||
|
||||
/**
|
||||
* metadata center address
|
||||
* The address of the metadata center.
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* Default port for metadata center
|
||||
* The default port for the metadata center.
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* Username to login metadata center
|
||||
* The username used to log in to the metadata center.
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* Password to login metadata center
|
||||
* The password used to log in to the metadata center.
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* Request timeout in milliseconds for metadata center
|
||||
* The request timeout in milliseconds for the metadata center.
|
||||
*/
|
||||
private Integer timeout;
|
||||
|
||||
/**
|
||||
* The group the metadata in . It is the same as registry
|
||||
* The group for the metadata center, which is similar to the registry group.
|
||||
*/
|
||||
private String group;
|
||||
|
||||
/**
|
||||
* Customized parameters
|
||||
* Customized parameters for the metadata center.
|
||||
*/
|
||||
private Map<String, String> parameters;
|
||||
|
||||
/**
|
||||
* The number of retry times when connecting to the metadata center.
|
||||
*/
|
||||
private Integer retryTimes;
|
||||
|
||||
private Integer retryPeriod;
|
||||
/**
|
||||
* By default, the metadata store will store full metadata repeatedly every day .
|
||||
* The retry period in milliseconds when connecting to the metadata center.
|
||||
*/
|
||||
private Integer retryPeriod;
|
||||
|
||||
/**
|
||||
* By default, the metadata store will store full metadata repeatedly every day.
|
||||
*/
|
||||
private Boolean cycleReport;
|
||||
|
||||
/**
|
||||
* Sync report, default async
|
||||
* Synchronization report, with the default value as asynchronous.
|
||||
*/
|
||||
private Boolean syncReport;
|
||||
|
||||
/**
|
||||
* cluster
|
||||
* Whether to use a cluster configuration for the metadata center.
|
||||
*/
|
||||
private Boolean cluster;
|
||||
|
||||
/**
|
||||
* registry id
|
||||
* The registry ID for the metadata center.
|
||||
*/
|
||||
private String registry;
|
||||
|
||||
/**
|
||||
* File for saving metadata center dynamic list
|
||||
* The file path for saving the metadata center's dynamic list.
|
||||
*/
|
||||
private String file;
|
||||
|
||||
/**
|
||||
* Decide the behaviour when initial connection try fails,
|
||||
* 'true' means interrupt the whole process once fail.
|
||||
* The default value is true
|
||||
* Decide the behavior when the initial connection attempt fails, where 'true' means interrupt the whole process once it fails.
|
||||
* The default value is true.
|
||||
*/
|
||||
private Boolean check;
|
||||
|
||||
/**
|
||||
* Whether to report metadata.
|
||||
*/
|
||||
private Boolean reportMetadata;
|
||||
|
||||
/**
|
||||
* Whether to report definition.
|
||||
*/
|
||||
private Boolean reportDefinition;
|
||||
|
||||
public MetadataReportConfig() {
|
||||
|
|
|
|||
|
|
@ -28,98 +28,111 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* MetricsConfig
|
||||
* Configuration for the metrics.
|
||||
*/
|
||||
public class MetricsConfig extends AbstractConfig {
|
||||
|
||||
private static final long serialVersionUID = -9089919311611546383L;
|
||||
|
||||
/**
|
||||
* Protocol used for metrics.
|
||||
*/
|
||||
private String protocol;
|
||||
|
||||
/**
|
||||
* Enable jvm metrics when collecting.
|
||||
* Whether to enable JVM metrics collection.
|
||||
*/
|
||||
private Boolean enableJvm;
|
||||
|
||||
/**
|
||||
* Enable threadpool metrics when collecting.
|
||||
* Whether to enable thread pool metrics collection.
|
||||
*/
|
||||
private Boolean enableThreadpool;
|
||||
|
||||
/**
|
||||
* Enable registry metrics.
|
||||
* Whether to enable registry metrics collection.
|
||||
*/
|
||||
private Boolean enableRegistry;
|
||||
|
||||
/**
|
||||
* Enable metadata metrics.
|
||||
* Whether to enable metadata metrics collection.
|
||||
*/
|
||||
private Boolean enableMetadata;
|
||||
|
||||
/**
|
||||
* Export metrics service.
|
||||
* Whether to export metrics service.
|
||||
*/
|
||||
private Boolean exportMetricsService;
|
||||
|
||||
/**
|
||||
* Enable netty metrics.
|
||||
* Whether to enable Netty metrics collection.
|
||||
*/
|
||||
private Boolean enableNetty;
|
||||
|
||||
/**
|
||||
* Enable metrics init.
|
||||
* Whether to enable metrics initialization.
|
||||
*/
|
||||
private Boolean enableMetricsInit;
|
||||
|
||||
/**
|
||||
* Enable collector sync.
|
||||
* Whether to enable collector synchronization.
|
||||
*/
|
||||
private Boolean enableCollectorSync;
|
||||
|
||||
/**
|
||||
* Collector sync period.
|
||||
* Collector synchronization period.
|
||||
*/
|
||||
private Integer collectorSyncPeriod;
|
||||
|
||||
/**
|
||||
* @deprecated After metrics config is refactored.
|
||||
* This parameter should no longer use and will be deleted in the future.
|
||||
* Deprecated: This parameter should no longer be used and will be removed in the future.
|
||||
*/
|
||||
@Deprecated
|
||||
private String port;
|
||||
|
||||
/**
|
||||
* The prometheus metrics config
|
||||
* Configuration for Prometheus metrics collection.
|
||||
*/
|
||||
@Nested
|
||||
private PrometheusConfig prometheus;
|
||||
|
||||
/**
|
||||
* The metrics aggregation config
|
||||
* Configuration for metrics aggregation.
|
||||
*/
|
||||
@Nested
|
||||
private AggregationConfig aggregation;
|
||||
|
||||
/**
|
||||
* Configuration for metrics histogram.
|
||||
*/
|
||||
@Nested
|
||||
private HistogramConfig histogram;
|
||||
|
||||
/**
|
||||
* Protocol used for metrics collection and export.
|
||||
*/
|
||||
private String exportServiceProtocol;
|
||||
|
||||
/**
|
||||
* Port used for exporting metrics services.
|
||||
*/
|
||||
private Integer exportServicePort;
|
||||
|
||||
/**
|
||||
* Decide whether to use the global registry of the micrometer.
|
||||
* Decide whether to use the global registry of Micrometer.
|
||||
*/
|
||||
private Boolean useGlobalRegistry;
|
||||
|
||||
/**
|
||||
* Whether to enable RPC (Remote Procedure Call) metrics collection.
|
||||
*/
|
||||
private Boolean enableRpc;
|
||||
|
||||
/**
|
||||
* The level of the metrics, the value can be "SERVICE", "METHOD", default is method.
|
||||
* The level of metrics collection, which can be "SERVICE" or "METHOD". The default is "METHOD".
|
||||
*/
|
||||
private String rpcLevel;
|
||||
|
||||
|
||||
public MetricsConfig() {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The module info
|
||||
* Configuration for the module.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
|
|
@ -36,22 +36,22 @@ public class ModuleConfig extends AbstractConfig {
|
|||
private static final long serialVersionUID = 5508512956753757169L;
|
||||
|
||||
/**
|
||||
* Module name
|
||||
* The module name
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Module version
|
||||
* The module version
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* Module owner
|
||||
* The module owner
|
||||
*/
|
||||
private String owner;
|
||||
|
||||
/**
|
||||
* Module's organization
|
||||
* The module's organization
|
||||
*/
|
||||
private String organization;
|
||||
|
||||
|
|
@ -66,35 +66,35 @@ public class ModuleConfig extends AbstractConfig {
|
|||
private MonitorConfig monitor;
|
||||
|
||||
/**
|
||||
* Whether start module in background.
|
||||
* If start in background, do not await finish on Spring ContextRefreshedEvent.
|
||||
* Whether to start the module in the background.
|
||||
* If started in the background, it does not await finish on Spring ContextRefreshedEvent.
|
||||
*
|
||||
* @see org.apache.dubbo.config.spring.context.DubboDeployApplicationListener
|
||||
*/
|
||||
private Boolean background;
|
||||
|
||||
/**
|
||||
* Weather the reference is referred asynchronously
|
||||
* Whether the reference is referred asynchronously.
|
||||
*/
|
||||
private Boolean referAsync;
|
||||
|
||||
/**
|
||||
* Thread num for asynchronous refer pool size
|
||||
* The thread number for asynchronous reference pool size.
|
||||
*/
|
||||
private Integer referThreadNum;
|
||||
|
||||
/**
|
||||
* Weather the service is export asynchronously
|
||||
* Whether the service is exported asynchronously.
|
||||
*/
|
||||
private Boolean exportAsync;
|
||||
|
||||
/**
|
||||
* Thread num for asynchronous export pool size
|
||||
* The thread number for asynchronous export pool size.
|
||||
*/
|
||||
private Integer exportThreadNum;
|
||||
|
||||
/**
|
||||
* The timeout to check references
|
||||
* The timeout to check references.
|
||||
*/
|
||||
private Long checkReferenceTimeout;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import org.apache.dubbo.rpc.model.ApplicationModel;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* MonitorConfig
|
||||
* Configuration for the monitor.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
|
|
@ -33,8 +33,8 @@ public class MonitorConfig extends AbstractConfig {
|
|||
private static final long serialVersionUID = -1184681514659198203L;
|
||||
|
||||
/**
|
||||
* The protocol of the monitor, if the value is registry, it will search the monitor address from the registry center,
|
||||
* otherwise, it will directly connect to the monitor center
|
||||
* The protocol of the monitor. If the value is "registry" it will search the monitor address from the registry center.
|
||||
* Otherwise, it will directly connect to the monitor center.
|
||||
*/
|
||||
private String protocol;
|
||||
|
||||
|
|
@ -49,18 +49,27 @@ public class MonitorConfig extends AbstractConfig {
|
|||
private String username;
|
||||
|
||||
/**
|
||||
* The password
|
||||
* The monitor password
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* The monitor group
|
||||
*/
|
||||
private String group;
|
||||
|
||||
/**
|
||||
* The monitor version
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* The monitor reporting interval
|
||||
*/
|
||||
private String interval;
|
||||
|
||||
/**
|
||||
* customized parameters
|
||||
* Customized parameters
|
||||
*/
|
||||
private Map<String, String> parameters;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_UNEXP
|
|||
import static org.apache.dubbo.common.constants.ProviderConstants.DEFAULT_PREFER_SERIALIZATION;
|
||||
|
||||
/**
|
||||
* ProtocolConfig
|
||||
* Configuration for the protocol.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
|
|
@ -42,194 +42,198 @@ public class ProtocolConfig extends AbstractConfig {
|
|||
private static final long serialVersionUID = 6913423882496634749L;
|
||||
|
||||
/**
|
||||
* Protocol name
|
||||
* The name of the protocol.
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Service ip address (when there are multiple network cards available)
|
||||
* The service's IP address (useful when there are multiple network cards available).
|
||||
*/
|
||||
private String host;
|
||||
|
||||
/**
|
||||
* Service port
|
||||
* The service's port number.
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* Context path
|
||||
* The context path for the service.
|
||||
*/
|
||||
private String contextpath;
|
||||
|
||||
/**
|
||||
* Thread pool
|
||||
* The name of the thread pool.
|
||||
*/
|
||||
private String threadpool;
|
||||
|
||||
/**
|
||||
* Thread pool name
|
||||
*/
|
||||
private String threadname;
|
||||
|
||||
/**
|
||||
* Thread pool core thread size
|
||||
* The core thread size of the thread pool.
|
||||
*/
|
||||
private Integer corethreads;
|
||||
|
||||
/**
|
||||
* Thread pool size (fixed size)
|
||||
* The fixed size of the thread pool.
|
||||
*/
|
||||
private Integer threads;
|
||||
|
||||
/**
|
||||
* IO thread pool size (fixed size)
|
||||
* The fixed size of the IO thread pool.
|
||||
*/
|
||||
private Integer iothreads;
|
||||
|
||||
/**
|
||||
* Thread pool keepAliveTime, default unit TimeUnit.MILLISECONDS
|
||||
* The keep-alive time for threads in the thread pool (default unit is TimeUnit.MILLISECONDS).
|
||||
*/
|
||||
private Integer alive;
|
||||
|
||||
/**
|
||||
* Thread pool's queue length
|
||||
* The length of the thread pool's queue.
|
||||
*/
|
||||
private Integer queues;
|
||||
|
||||
|
||||
/**
|
||||
* Thread pool exhausted listeners
|
||||
* Listeners for exhausted thread pool.
|
||||
*/
|
||||
private String threadPoolExhaustedListeners;
|
||||
|
||||
/**
|
||||
* Max acceptable connections
|
||||
* The maximum acceptable connections.
|
||||
*/
|
||||
private Integer accepts;
|
||||
|
||||
/**
|
||||
* Protocol codec
|
||||
* The protocol codec.
|
||||
*/
|
||||
private String codec;
|
||||
|
||||
/**
|
||||
* Serialization
|
||||
* The serialization method.
|
||||
*/
|
||||
private String serialization;
|
||||
|
||||
/**
|
||||
* If the parameter has a value, the consumer will read the parameter first.
|
||||
* Specifies the preferred serialization method for the consumer.
|
||||
* If specified, the consumer will use this parameter first.
|
||||
* If the Dubbo Sdk you are using contains the serialization type, the serialization method specified by the argument is used.
|
||||
* <p>
|
||||
* When this parameter is null or the serialization type specified by this parameter does not exist in the Dubbo SDK, the serialization type specified by serialization is used.
|
||||
* If the Dubbo SDK if still does not exist, the default type of the Dubbo SDK is used.
|
||||
* For Dubbo SDK >= 3.2, <code>preferSerialization</code> takes precedence over <code>serialization</code>
|
||||
* <p>
|
||||
* The configuration supports multiple, which are separated by commas.Such as:<code>fastjson2,fastjson,hessian2</code>
|
||||
* Supports multiple values separated by commas, e.g., "fastjson2,fastjson,hessian2".
|
||||
*/
|
||||
private String preferSerialization; // default:fastjson2,hessian2
|
||||
|
||||
/**
|
||||
* Charset
|
||||
* The character set used for communication.
|
||||
*/
|
||||
private String charset;
|
||||
|
||||
/**
|
||||
* Payload max length
|
||||
* The maximum payload length.
|
||||
*/
|
||||
private Integer payload;
|
||||
|
||||
/**
|
||||
* Buffer size
|
||||
* The buffer size.
|
||||
*/
|
||||
private Integer buffer;
|
||||
|
||||
/**
|
||||
* Heartbeat interval
|
||||
* The interval for sending heartbeats.
|
||||
*/
|
||||
private Integer heartbeat;
|
||||
|
||||
/**
|
||||
* Access log
|
||||
* The access log configuration.
|
||||
*/
|
||||
private String accesslog;
|
||||
|
||||
/**
|
||||
* Transporter
|
||||
* The transporter used for communication.
|
||||
*/
|
||||
private String transporter;
|
||||
|
||||
/**
|
||||
* How information is exchanged
|
||||
* The method of information exchange.
|
||||
*/
|
||||
private String exchanger;
|
||||
|
||||
/**
|
||||
* Thread dispatch mode
|
||||
* The thread dispatch mode.
|
||||
*/
|
||||
private String dispatcher;
|
||||
|
||||
/**
|
||||
* Networker
|
||||
* The networker implementation.
|
||||
*/
|
||||
private String networker;
|
||||
|
||||
/**
|
||||
* Sever impl
|
||||
* The server implementation.
|
||||
*/
|
||||
private String server;
|
||||
|
||||
/**
|
||||
* Client impl
|
||||
* The client implementation.
|
||||
*/
|
||||
private String client;
|
||||
|
||||
/**
|
||||
* Supported telnet commands, separated with comma.
|
||||
* Supported Telnet commands, separated by commas.
|
||||
*/
|
||||
private String telnet;
|
||||
|
||||
/**
|
||||
* Command line prompt
|
||||
* The command line prompt.
|
||||
*/
|
||||
private String prompt;
|
||||
|
||||
/**
|
||||
* Status check
|
||||
* The status check configuration.
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* Whether to register
|
||||
* Indicates whether the service should be registered.
|
||||
*/
|
||||
private Boolean register;
|
||||
|
||||
// TODO: Move this property to the provider configuration.
|
||||
/**
|
||||
* whether it is a persistent connection
|
||||
* Indicates whether it is a persistent connection.
|
||||
*/
|
||||
//TODO add this to provider config
|
||||
private Boolean keepAlive;
|
||||
|
||||
// TODO add this to provider config
|
||||
// TODO: Move this property to the provider configuration.
|
||||
/**
|
||||
* The optimizer used for dubbo protocol.
|
||||
*/
|
||||
private String optimizer;
|
||||
|
||||
/**
|
||||
* The extension
|
||||
* Additional extensions.
|
||||
*/
|
||||
private String extension;
|
||||
|
||||
/**
|
||||
* The customized parameters
|
||||
* Custom parameters.
|
||||
*/
|
||||
private Map<String, String> parameters;
|
||||
|
||||
/**
|
||||
* Indicates whether SSL is enabled.
|
||||
*/
|
||||
private Boolean sslEnabled;
|
||||
|
||||
/*
|
||||
* Extra Protocol for this service, using Port Unification Server
|
||||
/**
|
||||
* Extra protocol for this service, using Port Unification Server.
|
||||
*/
|
||||
private String extProtocol;
|
||||
|
||||
/**
|
||||
* JSON check level for serialization.
|
||||
*/
|
||||
private String jsonCheckLevel;
|
||||
|
||||
public ProtocolConfig() {
|
||||
|
|
@ -326,14 +330,6 @@ public class ProtocolConfig extends AbstractConfig {
|
|||
this.threadpool = threadpool;
|
||||
}
|
||||
|
||||
public String getThreadname() {
|
||||
return threadname;
|
||||
}
|
||||
|
||||
public void setThreadname(String threadname) {
|
||||
this.threadname = threadname;
|
||||
}
|
||||
|
||||
@Parameter(key = JSON_CHECK_LEVEL_KEY)
|
||||
public String getJsonCheckLevel() {
|
||||
return jsonCheckLevel;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.EXPORT_BACKGROUN
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.EXPORT_THREAD_NUM_KEY;
|
||||
|
||||
/**
|
||||
* The service provider default configuration
|
||||
* Configuration for the service provider.
|
||||
*
|
||||
* @export
|
||||
* @see org.apache.dubbo.config.ProtocolConfig
|
||||
|
|
@ -36,137 +36,137 @@ public class ProviderConfig extends AbstractServiceConfig {
|
|||
|
||||
private static final long serialVersionUID = 6913423882496634749L;
|
||||
|
||||
// ======== protocol default values, it'll take effect when protocol's attributes are not set ========
|
||||
/* ======== Default values for protocols, which take effect when protocol attributes are not set ======== */
|
||||
|
||||
/**
|
||||
* Service ip addresses (used when there are multiple network cards available)
|
||||
* The IP addresses of the service (used when there are multiple network cards available).
|
||||
*/
|
||||
private String host;
|
||||
|
||||
/**
|
||||
* Service port
|
||||
* The port of the service.
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* Context path
|
||||
* The context path of the service.
|
||||
*/
|
||||
private String contextpath;
|
||||
|
||||
/**
|
||||
* Thread pool
|
||||
* The thread pool configuration.
|
||||
*/
|
||||
private String threadpool;
|
||||
|
||||
/**
|
||||
* Thread pool name
|
||||
* The name of the thread pool.
|
||||
*/
|
||||
private String threadname;
|
||||
|
||||
/**
|
||||
* Thread pool size (fixed size)
|
||||
* The size of the thread pool (fixed size).
|
||||
*/
|
||||
private Integer threads;
|
||||
|
||||
/**
|
||||
* IO thread pool size (fixed size)
|
||||
* The size of the I/O thread pool (fixed size).
|
||||
*/
|
||||
private Integer iothreads;
|
||||
|
||||
/**
|
||||
* Thread pool keepAliveTime, default unit TimeUnit.MILLISECONDS
|
||||
* The keep-alive time of the thread pool, default unit: TimeUnit.MILLISECONDS.
|
||||
*/
|
||||
private Integer alive;
|
||||
|
||||
/**
|
||||
* Thread pool queue length
|
||||
* The length of the thread pool queue.
|
||||
*/
|
||||
private Integer queues;
|
||||
|
||||
/**
|
||||
* Max acceptable connections
|
||||
* The maximum number of acceptable connections.
|
||||
*/
|
||||
private Integer accepts;
|
||||
|
||||
/**
|
||||
* Protocol codec
|
||||
* The codec used by the protocol.
|
||||
*/
|
||||
private String codec;
|
||||
|
||||
/**
|
||||
* The serialization charset
|
||||
* The charset used for serialization.
|
||||
*/
|
||||
private String charset;
|
||||
|
||||
/**
|
||||
* Payload max length
|
||||
* The maximum payload length.
|
||||
*/
|
||||
private Integer payload;
|
||||
|
||||
/**
|
||||
* The network io buffer size
|
||||
* The size of the network I/O buffer.
|
||||
*/
|
||||
private Integer buffer;
|
||||
|
||||
/**
|
||||
* Transporter
|
||||
* The transporter used by the protocol.
|
||||
*/
|
||||
private String transporter;
|
||||
|
||||
/**
|
||||
* How information gets exchanged
|
||||
* The method of information exchange.
|
||||
*/
|
||||
private String exchanger;
|
||||
|
||||
/**
|
||||
* Thread dispatching mode
|
||||
* The mode of thread dispatching.
|
||||
*/
|
||||
private String dispatcher;
|
||||
|
||||
/**
|
||||
* Networker
|
||||
* The networker used by the protocol.
|
||||
*/
|
||||
private String networker;
|
||||
|
||||
/**
|
||||
* The server-side implementation model of the protocol
|
||||
* The server-side implementation model of the protocol.
|
||||
*/
|
||||
private String server;
|
||||
|
||||
/**
|
||||
* The client-side implementation model of the protocol
|
||||
* The client-side implementation model of the protocol.
|
||||
*/
|
||||
private String client;
|
||||
|
||||
/**
|
||||
* Supported telnet commands, separated with comma.
|
||||
* Supported telnet commands, separated by commas.
|
||||
*/
|
||||
private String telnet;
|
||||
|
||||
/**
|
||||
* Command line prompt
|
||||
* The command line prompt.
|
||||
*/
|
||||
private String prompt;
|
||||
|
||||
/**
|
||||
* Status check
|
||||
* The status check configuration.
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* Wait time when stop
|
||||
* The wait time when stopping the service.
|
||||
*/
|
||||
private Integer wait;
|
||||
|
||||
/**
|
||||
* Thread num for asynchronous export pool size
|
||||
* The number of threads for the asynchronous export pool.
|
||||
*/
|
||||
private Integer exportThreadNum;
|
||||
|
||||
/**
|
||||
* Whether export should run in background or not.
|
||||
* Whether the export should run in the background or not.
|
||||
*
|
||||
* @deprecated replace with {@link ModuleConfig#setBackground(Boolean)}
|
||||
* @deprecated Replace with {@link ModuleConfig#setBackground(Boolean)}
|
||||
* @see ModuleConfig#setBackground(Boolean)
|
||||
*/
|
||||
private Boolean exportBackground;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.UNLOAD_CLUSTER_R
|
|||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_UNEXPECTED_EXCEPTION;
|
||||
|
||||
/**
|
||||
* ReferenceConfig
|
||||
* Base configuration for the service reference.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
|
|
@ -56,24 +56,23 @@ public abstract class ReferenceConfigBase<T> extends AbstractReferenceConfig {
|
|||
private static final String ORIGIN_CONFIG = "ORIGIN_CONFIG";
|
||||
|
||||
/**
|
||||
* The interface class of the reference service
|
||||
* The interface class of the reference service.
|
||||
*/
|
||||
protected Class<?> interfaceClass;
|
||||
|
||||
|
||||
/**
|
||||
* The url for peer-to-peer invocation
|
||||
* The URL for peer-to-peer invocation.
|
||||
*/
|
||||
protected String url;
|
||||
|
||||
/**
|
||||
* The consumer config (default)
|
||||
* The default consumer configuration.
|
||||
*/
|
||||
protected ConsumerConfig consumer;
|
||||
|
||||
/**
|
||||
* In the mesh mode, uninstall the directory, router and load balance related to the cluster in the currently invoked invoker.
|
||||
* Delegate retry, load balancing, timeout and other traffic management capabilities to Sidecar.
|
||||
* In mesh mode, this flag uninstalls the directory, router, and load balancing configurations related to the cluster in the currently invoked invoker.
|
||||
* It delegates retry, load balancing, timeout, and other traffic management capabilities to Sidecar.
|
||||
*/
|
||||
protected Boolean unloadClusterRelated;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,157 +33,177 @@ import static org.apache.dubbo.common.constants.RemotingConstants.BACKUP_KEY;
|
|||
import static org.apache.dubbo.common.utils.PojoUtils.updatePropertyIfAbsent;
|
||||
|
||||
/**
|
||||
* RegistryConfig
|
||||
* Configuration for service registration and discovery.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
public class RegistryConfig extends AbstractConfig {
|
||||
|
||||
public static final String NO_AVAILABLE = "N/A";
|
||||
private static final long serialVersionUID = 5508512956753757169L;
|
||||
|
||||
public static final String NO_AVAILABLE = "N/A";
|
||||
|
||||
/**
|
||||
* Register center address
|
||||
* Register center address.
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* Username to login register center
|
||||
* Username to login the register center.
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* Password to login register center
|
||||
* Password to login the register center.
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* Default port for register center
|
||||
* Default port for the register center.
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* Protocol for register center
|
||||
* Protocol used for the register center.
|
||||
*/
|
||||
private String protocol;
|
||||
|
||||
/**
|
||||
* Network transmission type
|
||||
* Network transmission type.
|
||||
*/
|
||||
private String transporter;
|
||||
|
||||
/**
|
||||
* Server implementation.
|
||||
*/
|
||||
private String server;
|
||||
|
||||
/**
|
||||
* Client implementation.
|
||||
*/
|
||||
private String client;
|
||||
|
||||
/**
|
||||
* Affects how traffic distributes among registries, useful when subscribing multiple registries, available options:
|
||||
* 1. zone-aware, a certain type of traffic always goes to one Registry according to where the traffic is originated.
|
||||
* Affects how traffic distributes among registries, useful when subscribing to multiple registries.
|
||||
* Available options:
|
||||
* - "zone-aware": A certain type of traffic always goes to one Registry according to where the traffic is originated.
|
||||
*/
|
||||
private String cluster;
|
||||
|
||||
/**
|
||||
* The region where the registry belongs, usually used to isolate traffics
|
||||
* The region where the registry belongs, usually used to isolate traffics.
|
||||
*/
|
||||
private String zone;
|
||||
|
||||
/**
|
||||
* The group that services registry in
|
||||
* The group that services registry belongs to.
|
||||
*/
|
||||
private String group;
|
||||
|
||||
/**
|
||||
* Version of the registry.
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* Connect timeout in milliseconds for register center
|
||||
* Connect timeout in milliseconds for the register center.
|
||||
*/
|
||||
private Integer timeout;
|
||||
|
||||
/**
|
||||
* Session timeout in milliseconds for register center
|
||||
* Session timeout in milliseconds for the register center.
|
||||
*/
|
||||
private Integer session;
|
||||
|
||||
/**
|
||||
* File for saving register center dynamic list
|
||||
* File for saving the register center dynamic list.
|
||||
*/
|
||||
private String file;
|
||||
|
||||
/**
|
||||
* Wait time before stop
|
||||
* Wait time before stopping.
|
||||
*/
|
||||
private Integer wait;
|
||||
|
||||
/**
|
||||
* Whether to check if register center is available when boot up
|
||||
* Whether to check if the register center is available when booting up.
|
||||
*/
|
||||
private Boolean check;
|
||||
|
||||
/**
|
||||
* Whether to allow dynamic service to register on the register center
|
||||
* Whether to allow dynamic service registration on the register center.
|
||||
*/
|
||||
private Boolean dynamic;
|
||||
|
||||
/**
|
||||
* Whether to allow exporting service on the register center
|
||||
* Whether to allow exporting service on the register center.
|
||||
*/
|
||||
private Boolean register;
|
||||
|
||||
/**
|
||||
* Whether to allow subscribing service on the register center
|
||||
* Whether to allow subscribing to services on the register center.
|
||||
*/
|
||||
private Boolean subscribe;
|
||||
|
||||
/**
|
||||
* The customized parameters
|
||||
* Customized parameters.
|
||||
*/
|
||||
private Map<String, String> parameters;
|
||||
|
||||
/**
|
||||
* Simple the registry. both useful for provider and consumer
|
||||
* Simplify the registry, useful for both providers and consumers.
|
||||
*
|
||||
* @since 2.7.0
|
||||
*/
|
||||
private Boolean simplified;
|
||||
|
||||
/**
|
||||
* After simplify the registry, should add some parameter individually. just for provider.
|
||||
* <p>
|
||||
* such as: extra-keys = A,b,c,d
|
||||
* After simplifying the registry, add some parameters individually, useful for providers.
|
||||
* Example: extra-keys = "A, b, c, d".
|
||||
*
|
||||
* @since 2.7.0
|
||||
*/
|
||||
private String extraKeys;
|
||||
|
||||
/**
|
||||
* the address work as config center or not
|
||||
* Indicates whether the address works as a configuration center or not.
|
||||
*/
|
||||
private Boolean useAsConfigCenter;
|
||||
|
||||
/**
|
||||
* the address work as remote metadata center or not
|
||||
* Indicates whether the address works as a remote metadata center or not.
|
||||
*/
|
||||
private Boolean useAsMetadataCenter;
|
||||
|
||||
/**
|
||||
* list of rpc protocols accepted by this registry, for example, "dubbo,rest"
|
||||
* List of RPC protocols accepted by this registry, e.g., "dubbo,rest".
|
||||
*/
|
||||
private String accepts;
|
||||
|
||||
/**
|
||||
* Always use this registry first if set to true, useful when subscribe to multiple registries
|
||||
* Always use this registry first if set to true, useful when subscribing to multiple registries.
|
||||
*/
|
||||
private Boolean preferred;
|
||||
|
||||
/**
|
||||
* Affects traffic distribution among registries, useful when subscribe to multiple registries
|
||||
* Take effect only when no preferred registry is specified.
|
||||
* Affects traffic distribution among registries, useful when subscribing to multiple registries.
|
||||
* Takes effect only when no preferred registry is specified.
|
||||
*/
|
||||
private Integer weight;
|
||||
|
||||
/**
|
||||
* Register mode.
|
||||
*/
|
||||
private String registerMode;
|
||||
|
||||
/**
|
||||
* Enable empty protection.
|
||||
*/
|
||||
private Boolean enableEmptyProtection;
|
||||
|
||||
/**
|
||||
* Security settings.
|
||||
*/
|
||||
private String secure;
|
||||
|
||||
public String getSecure() {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATT
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.DUBBO;
|
||||
|
||||
/**
|
||||
* ServiceConfig
|
||||
* Base configuration for service.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
|
|
@ -51,38 +51,37 @@ public abstract class ServiceConfigBase<T> extends AbstractServiceConfig {
|
|||
|
||||
private static final long serialVersionUID = 3033787999037024738L;
|
||||
|
||||
|
||||
/**
|
||||
* The interface class of the exported service
|
||||
* The interface class of the exported service.
|
||||
*/
|
||||
protected Class<?> interfaceClass;
|
||||
|
||||
/**
|
||||
* The reference of the interface implementation
|
||||
* The reference to the interface implementation.
|
||||
*/
|
||||
protected transient T ref;
|
||||
|
||||
/**
|
||||
* The service name
|
||||
* The service name, which is used to uniquely identify the service.
|
||||
*/
|
||||
protected String path;
|
||||
|
||||
/**
|
||||
* The provider configuration
|
||||
* The provider configuration for this service.
|
||||
*/
|
||||
protected ProviderConfig provider;
|
||||
|
||||
/**
|
||||
* The providerIds
|
||||
* A comma-separated list of provider IDs.
|
||||
*/
|
||||
protected String providerIds;
|
||||
|
||||
/**
|
||||
* whether it is a GenericService
|
||||
* Indicates whether the service is a GenericService.
|
||||
* If set, this means that the service is a generic service that can handle multiple types.
|
||||
*/
|
||||
protected volatile String generic;
|
||||
|
||||
|
||||
public ServiceConfigBase() {
|
||||
serviceMetadata = new ServiceMetadata();
|
||||
serviceMetadata.addAttribute("ORIGIN_CONFIG", this);
|
||||
|
|
@ -285,7 +284,6 @@ public abstract class ServiceConfigBase<T> extends AbstractServiceConfig {
|
|||
setInterface(interfaceClass);
|
||||
}
|
||||
|
||||
|
||||
public void setInterface(Class<?> interfaceClass) {
|
||||
// rest protocol allow set impl class
|
||||
if (interfaceClass != null && !interfaceClass.isInterface() && !canSkipInterfaceCheck()) {
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package org.apache.dubbo.config;
|
||||
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.IOUtils;
|
||||
import org.apache.dubbo.config.support.Parameter;
|
||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
|
|
@ -26,9 +24,14 @@ import java.beans.Transient;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Configuration for ssl.
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
public class SslConfig extends AbstractConfig {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SslConfig.class);
|
||||
private static final long serialVersionUID = 4072725016922915851L;
|
||||
|
||||
public static final String SERVER_KEY_CERT_CHAIN_PATH = "server-key-cert-chain-path";
|
||||
|
||||
|
|
@ -46,27 +49,94 @@ public class SslConfig extends AbstractConfig {
|
|||
|
||||
public static final String CLIENT_TRUST_CERT_COLLECTION_PATH = "client-trust-cert-collection-path";
|
||||
|
||||
/**
|
||||
* Path to the server's key certificate chain file.
|
||||
*/
|
||||
private String serverKeyCertChainPath;
|
||||
|
||||
/**
|
||||
* Path to the server's private key file.
|
||||
*/
|
||||
private String serverPrivateKeyPath;
|
||||
|
||||
/**
|
||||
* Password for the server's private key (if applicable).
|
||||
*/
|
||||
private String serverKeyPassword;
|
||||
|
||||
/**
|
||||
* Path to the server's trust certificate collection file.
|
||||
*/
|
||||
private String serverTrustCertCollectionPath;
|
||||
|
||||
/**
|
||||
* Path to the client's key certificate chain file.
|
||||
*/
|
||||
private String clientKeyCertChainPath;
|
||||
|
||||
/**
|
||||
* Path to the client's private key file.
|
||||
*/
|
||||
private String clientPrivateKeyPath;
|
||||
|
||||
/**
|
||||
* Password for the client's private key (if applicable).
|
||||
*/
|
||||
private String clientKeyPassword;
|
||||
|
||||
/**
|
||||
* Path to the client's trust certificate collection file.
|
||||
*/
|
||||
private String clientTrustCertCollectionPath;
|
||||
|
||||
/**
|
||||
* Input stream for the server's key certificate chain (if provided).
|
||||
*/
|
||||
private InputStream serverKeyCertChainPathStream;
|
||||
|
||||
/**
|
||||
* Input stream for the server's private key (if provided).
|
||||
*/
|
||||
private InputStream serverPrivateKeyPathStream;
|
||||
|
||||
/**
|
||||
* Input stream for the server's trust certificate collection (if provided).
|
||||
*/
|
||||
private InputStream serverTrustCertCollectionPathStream;
|
||||
|
||||
/**
|
||||
* Input stream for the client's key certificate chain (if provided).
|
||||
*/
|
||||
private InputStream clientKeyCertChainPathStream;
|
||||
|
||||
/**
|
||||
* Input stream for the client's private key (if provided).
|
||||
*/
|
||||
private InputStream clientPrivateKeyPathStream;
|
||||
|
||||
/**
|
||||
* Input stream for the client's trust certificate collection (if provided).
|
||||
*/
|
||||
private InputStream clientTrustCertCollectionPathStream;
|
||||
|
||||
/**
|
||||
* Address for Certificate Authority (CA).
|
||||
*/
|
||||
private String caAddress;
|
||||
|
||||
/**
|
||||
* Environment type for SSL configuration.
|
||||
*/
|
||||
private String envType;
|
||||
|
||||
/**
|
||||
* Path to the CA certificate file.
|
||||
*/
|
||||
private String caCertPath;
|
||||
|
||||
/**
|
||||
* Path to the OIDC (OpenID Connect) token file.
|
||||
*/
|
||||
private String oidcTokenPath;
|
||||
|
||||
public SslConfig() {
|
||||
|
|
|
|||
|
|
@ -25,34 +25,37 @@ import org.apache.dubbo.config.support.Nested;
|
|||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
|
||||
/**
|
||||
* TracingConfig
|
||||
* Configuration for tracing.
|
||||
*/
|
||||
public class TracingConfig extends AbstractConfig {
|
||||
|
||||
private static final long serialVersionUID = -9089919311611546383L;
|
||||
|
||||
/**
|
||||
* Indicates whether the feature is enabled (default is false).
|
||||
*/
|
||||
private Boolean enabled = false;
|
||||
|
||||
/**
|
||||
* Sampling configuration.
|
||||
* Configuration for sampling.
|
||||
*/
|
||||
@Nested
|
||||
private SamplingConfig sampling = new SamplingConfig();
|
||||
|
||||
/**
|
||||
* Baggage configuration.
|
||||
* Configuration for baggage.
|
||||
*/
|
||||
@Nested
|
||||
private BaggageConfig baggage = new BaggageConfig();
|
||||
|
||||
/**
|
||||
* Propagation configuration.
|
||||
* Configuration for propagation.
|
||||
*/
|
||||
@Nested
|
||||
private PropagationConfig propagation = new PropagationConfig();
|
||||
|
||||
/**
|
||||
* Exporter configuration.
|
||||
* Configuration for the tracing exporter.
|
||||
*/
|
||||
@Nested
|
||||
private ExporterConfig tracingExporter = new ExporterConfig();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* 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.dubbo.config;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Configuration for triple protocol.
|
||||
*/
|
||||
public class TripleConfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3682252713701362155L;
|
||||
|
||||
/**
|
||||
* The header table size.
|
||||
*/
|
||||
private String headerTableSize;
|
||||
|
||||
/**
|
||||
* Whether to enable push, default is false.
|
||||
*/
|
||||
private Boolean enablePush;
|
||||
|
||||
/**
|
||||
* Maximum concurrent streams.
|
||||
*/
|
||||
private String maxConcurrentStreams;
|
||||
|
||||
/**
|
||||
* Initial window size.
|
||||
*/
|
||||
private String initialWindowSize;
|
||||
|
||||
/**
|
||||
* Maximum frame size.
|
||||
*/
|
||||
private String maxFrameSize;
|
||||
|
||||
/**
|
||||
* Maximum header list size.
|
||||
*/
|
||||
private String maxHeaderListSize;
|
||||
|
||||
public String getHeaderTableSize() {
|
||||
return headerTableSize;
|
||||
}
|
||||
|
||||
public void setHeaderTableSize(String headerTableSize) {
|
||||
this.headerTableSize = headerTableSize;
|
||||
}
|
||||
|
||||
public Boolean getEnablePush() {
|
||||
return enablePush;
|
||||
}
|
||||
|
||||
public void setEnablePush(Boolean enablePush) {
|
||||
this.enablePush = enablePush;
|
||||
}
|
||||
|
||||
public String getMaxConcurrentStreams() {
|
||||
return maxConcurrentStreams;
|
||||
}
|
||||
|
||||
public void setMaxConcurrentStreams(String maxConcurrentStreams) {
|
||||
this.maxConcurrentStreams = maxConcurrentStreams;
|
||||
}
|
||||
|
||||
public String getInitialWindowSize() {
|
||||
return initialWindowSize;
|
||||
}
|
||||
|
||||
public void setInitialWindowSize(String initialWindowSize) {
|
||||
this.initialWindowSize = initialWindowSize;
|
||||
}
|
||||
|
||||
public String getMaxFrameSize() {
|
||||
return maxFrameSize;
|
||||
}
|
||||
|
||||
public void setMaxFrameSize(String maxFrameSize) {
|
||||
this.maxFrameSize = maxFrameSize;
|
||||
}
|
||||
|
||||
public String getMaxHeaderListSize() {
|
||||
return maxHeaderListSize;
|
||||
}
|
||||
|
||||
public void setMaxHeaderListSize(String maxHeaderListSize) {
|
||||
this.maxHeaderListSize = maxHeaderListSize;
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.apache.dubbo.config.annotation;
|
||||
|
||||
|
||||
import org.apache.dubbo.common.constants.ClusterRules;
|
||||
import org.apache.dubbo.common.constants.LoadbalanceRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.apache.dubbo.config.annotation;
|
||||
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.apache.dubbo.config.annotation;
|
||||
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,6 @@ public abstract class AbstractConfigManager extends LifecycleAdapter {
|
|||
uniqueConfigTypes.add(ModuleConfig.class);
|
||||
}
|
||||
|
||||
|
||||
public AbstractConfigManager(ScopeModel scopeModel, Collection<Class<? extends AbstractConfig>> supportedConfigTypes) {
|
||||
this.scopeModel = scopeModel;
|
||||
this.applicationModel = ScopeModelUtil.getApplicationModel(scopeModel);
|
||||
|
|
@ -567,7 +566,6 @@ public abstract class AbstractConfigManager extends LifecycleAdapter {
|
|||
return ConfigurationUtils.getSubIds(environment.getConfigurationMaps(), prefix);
|
||||
}
|
||||
|
||||
|
||||
protected <T extends AbstractConfig> void checkDefaultAndValidateConfigs(Class<T> configType) {
|
||||
try {
|
||||
if (shouldAddDefaultConfig(configType)) {
|
||||
|
|
@ -644,12 +642,10 @@ public abstract class AbstractConfigManager extends LifecycleAdapter {
|
|||
return this.getDefaultConfigs(clazz).isEmpty();
|
||||
}
|
||||
|
||||
|
||||
public void refreshAll() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* In some scenario, we may need to add and remove ServiceConfig or ReferenceConfig dynamically.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -57,14 +57,12 @@ public class ConfigManager extends AbstractConfigManager implements ApplicationE
|
|||
public static final String BEAN_NAME = "dubboConfigManager";
|
||||
public static final String DUBBO_CONFIG_MODE = ConfigKeys.DUBBO_CONFIG_MODE;
|
||||
|
||||
|
||||
public ConfigManager(ApplicationModel applicationModel) {
|
||||
super(applicationModel, Arrays.asList(ApplicationConfig.class, MonitorConfig.class,
|
||||
MetricsConfig.class, SslConfig.class, ProtocolConfig.class, RegistryConfig.class, ConfigCenterConfig.class,
|
||||
MetadataReportConfig.class, TracingConfig.class));
|
||||
}
|
||||
|
||||
|
||||
// ApplicationConfig correlative methods
|
||||
|
||||
/**
|
||||
|
|
@ -201,7 +199,6 @@ public class ConfigManager extends AbstractConfigManager implements ApplicationE
|
|||
return getConfigs(getTagName(ProtocolConfig.class));
|
||||
}
|
||||
|
||||
|
||||
// RegistryConfig correlative methods
|
||||
|
||||
public void addRegistry(RegistryConfig registryConfig) {
|
||||
|
|
@ -226,7 +223,6 @@ public class ConfigManager extends AbstractConfigManager implements ApplicationE
|
|||
return getConfigs(getTagName(RegistryConfig.class));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void refreshAll() {
|
||||
// refresh all configs here
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ public class ModuleConfigManager extends AbstractConfigManager implements Module
|
|||
private final Map<String, AbstractInterfaceConfig> serviceConfigCache = new ConcurrentHashMap<>();
|
||||
private final ConfigManager applicationConfigManager;
|
||||
|
||||
|
||||
public ModuleConfigManager(ModuleModel moduleModel) {
|
||||
super(moduleModel, Arrays.asList(ModuleConfig.class, ServiceConfigBase.class, ReferenceConfigBase.class, ProviderConfig.class, ConsumerConfig.class));
|
||||
applicationConfigManager = moduleModel.getApplicationModel().getApplicationConfigManager();
|
||||
|
|
@ -188,7 +187,6 @@ public class ModuleConfigManager extends AbstractConfigManager implements Module
|
|||
this.serviceConfigCache.clear();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected <C extends AbstractConfig> Optional<C> findDuplicatedConfig(Map<String, C> configsMap, C config) {
|
||||
// check duplicated configs
|
||||
|
|
@ -295,7 +293,6 @@ public class ModuleConfigManager extends AbstractConfigManager implements Module
|
|||
checkDefaultAndValidateConfigs(ModuleConfig.class);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Delegate read application configs
|
||||
//
|
||||
|
|
|
|||
|
|
@ -18,33 +18,48 @@ package org.apache.dubbo.config.nested;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Configuration for the metric aggregation.
|
||||
*/
|
||||
public class AggregationConfig implements Serializable {
|
||||
|
||||
/**
|
||||
* Enable local aggregation or not
|
||||
* Enable aggregation or not.
|
||||
*/
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* Enable QPS (Queries Per Second) aggregation or not.
|
||||
*/
|
||||
private Boolean enableQps;
|
||||
|
||||
/**
|
||||
* Enable Response Time Percentile (Pxx) aggregation or not.
|
||||
*/
|
||||
private Boolean enableRtPxx;
|
||||
|
||||
/**
|
||||
* Enable Response Time aggregation or not.
|
||||
*/
|
||||
private Boolean enableRt;
|
||||
|
||||
/**
|
||||
* Enable Request aggregation or not.
|
||||
*/
|
||||
private Boolean enableRequest;
|
||||
|
||||
/**
|
||||
* Bucket num for time window quantile
|
||||
* The number of buckets for time window quantile.
|
||||
*/
|
||||
private Integer bucketNum;
|
||||
|
||||
/**
|
||||
* Time window seconds for time window quantile
|
||||
* The time window in seconds for time window quantile.
|
||||
*/
|
||||
private Integer timeWindowSeconds;
|
||||
|
||||
/**
|
||||
* Time window mill seconds for qps
|
||||
* The time window in milliseconds for QPS (Queries Per Second) aggregation.
|
||||
*/
|
||||
private Integer qpsTimeWindowMillSeconds;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,14 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Configuration for the baggage.
|
||||
*/
|
||||
public class BaggageConfig implements Serializable {
|
||||
|
||||
/**
|
||||
* Whether baggage is enabled or not.
|
||||
*/
|
||||
private Boolean enabled = true;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,11 +24,20 @@ import java.time.Duration;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Configuration for the exporter.
|
||||
*/
|
||||
public class ExporterConfig implements Serializable {
|
||||
|
||||
/**
|
||||
* Configuration for the Zipkin.
|
||||
*/
|
||||
@Nested
|
||||
private ZipkinConfig zipkinConfig;
|
||||
|
||||
/**
|
||||
* Configuration for the OTLP.
|
||||
*/
|
||||
@Nested
|
||||
private OtlpConfig otlpConfig;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,20 +19,44 @@ package org.apache.dubbo.config.nested;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Configuration for the histogram.
|
||||
*/
|
||||
public class HistogramConfig implements Serializable {
|
||||
|
||||
/**
|
||||
* Whether histograms are enabled or not. Default is not enabled (false).
|
||||
*/
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* Buckets in milliseconds for the histograms. Defines the histogram bucket boundaries.
|
||||
*/
|
||||
private Integer[] bucketsMs;
|
||||
|
||||
/**
|
||||
* Minimum expected value in milliseconds for the histograms. Values lower than this will be considered outliers.
|
||||
*/
|
||||
private Integer minExpectedMs;
|
||||
|
||||
/**
|
||||
* Maximum expected value in milliseconds for the histograms. Values higher than this will be considered outliers.
|
||||
*/
|
||||
private Integer maxExpectedMs;
|
||||
|
||||
/**
|
||||
* Whether enabledPercentiles are enabled or not. Default is not enabled (false).
|
||||
*/
|
||||
private Boolean enabledPercentiles;
|
||||
|
||||
/**
|
||||
* Array of percentiles to be calculated for the histograms. Each percentile is a double value.
|
||||
*/
|
||||
private double[] percentiles;
|
||||
|
||||
/**
|
||||
* Expiry time in minutes for distribution statistics. After this time, the statistics are expired.
|
||||
*/
|
||||
private Integer distributionStatisticExpiryMin;
|
||||
|
||||
public Boolean getEnabled() {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ import org.apache.dubbo.config.support.Nested;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Configuration for the prometheus.
|
||||
*/
|
||||
public class PrometheusConfig implements Serializable {
|
||||
|
||||
/**
|
||||
|
|
@ -29,7 +32,7 @@ public class PrometheusConfig implements Serializable {
|
|||
private Exporter exporter;
|
||||
|
||||
/**
|
||||
* Prometheus Pushgateway configuration
|
||||
* Prometheus push gateway configuration
|
||||
*/
|
||||
@Nested
|
||||
private Pushgateway pushgateway;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ package org.apache.dubbo.config.nested;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Configuration for the propagation.
|
||||
*/
|
||||
public class PropagationConfig implements Serializable {
|
||||
|
||||
public static final String B3 = "B3";
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ package org.apache.dubbo.config.nested;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Configuration for the sampling.
|
||||
*/
|
||||
public class SamplingConfig implements Serializable {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,5 +29,4 @@ import java.lang.annotation.Target;
|
|||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
public @interface Nested {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
<description>Apache Dubbo Spring Boot Compatible for Spring Boot 1.x Auto-Configure</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Spring Boot dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
@ -50,13 +49,6 @@
|
|||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- @ConfigurationProperties annotation processing (metadata for IDEs) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-common</artifactId>
|
||||
|
|
@ -77,12 +69,33 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-spring-boot-configuration-metadata-compatible</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Test Dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>META-INF</targetPath>
|
||||
<directory>../metadata/target/classes/META-INF</directory>
|
||||
<includes>
|
||||
<include>spring-configuration-metadata.json</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
|
@ -50,7 +49,6 @@ import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_SCAN_PREFIX;
|
|||
@ConditionalOnProperty(prefix = DUBBO_PREFIX, name = "enabled", matchIfMissing = true)
|
||||
@Configuration
|
||||
@AutoConfigureAfter(DubboRelaxedBindingAutoConfiguration.class)
|
||||
@EnableConfigurationProperties(DubboConfigurationProperties.class)
|
||||
@EnableDubboConfig
|
||||
public class DubboAutoConfiguration {
|
||||
|
||||
|
|
@ -63,8 +61,7 @@ public class DubboAutoConfiguration {
|
|||
@ConditionalOnProperty(prefix = DUBBO_SCAN_PREFIX, name = BASE_PACKAGES_PROPERTY_NAME)
|
||||
@ConditionalOnBean(name = BASE_PACKAGES_BEAN_NAME)
|
||||
@Bean
|
||||
public ServiceAnnotationPostProcessor serviceAnnotationBeanProcessor(@Qualifier(BASE_PACKAGES_BEAN_NAME)
|
||||
Set<String> packagesToScan) {
|
||||
public ServiceAnnotationPostProcessor serviceAnnotationBeanProcessor(@Qualifier(BASE_PACKAGES_BEAN_NAME) Set<String> packagesToScan) {
|
||||
ServiceAnnotationPostProcessor serviceAnnotationPostProcessor;
|
||||
try {
|
||||
serviceAnnotationPostProcessor = (ServiceAnnotationPostProcessor) SpringCompatUtils.serviceAnnotationPostProcessor().getDeclaredConstructor(Collection.class).newInstance(packagesToScan);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.dubbo.spring.boot.autoconfigure;
|
||||
|
||||
import org.apache.dubbo.config.ApplicationConfig;
|
||||
import org.apache.dubbo.config.ConfigCenterConfig;
|
||||
import org.apache.dubbo.config.ConfigKeys;
|
||||
import org.apache.dubbo.config.ConsumerConfig;
|
||||
import org.apache.dubbo.config.MetadataReportConfig;
|
||||
|
|
@ -26,110 +27,154 @@ import org.apache.dubbo.config.MonitorConfig;
|
|||
import org.apache.dubbo.config.ProtocolConfig;
|
||||
import org.apache.dubbo.config.ProviderConfig;
|
||||
import org.apache.dubbo.config.RegistryConfig;
|
||||
import org.apache.dubbo.config.SslConfig;
|
||||
import org.apache.dubbo.config.TracingConfig;
|
||||
import org.apache.dubbo.config.context.ConfigMode;
|
||||
import org.apache.dubbo.config.spring.ConfigCenterBean;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
|
||||
import org.apache.dubbo.config.TripleConfig;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.apache.dubbo.spring.boot.util.DubboUtils.DEFAULT_MULTIPLE_CONFIG_PROPERTY_VALUE;
|
||||
import static org.apache.dubbo.spring.boot.util.DubboUtils.DEFAULT_OVERRIDE_CONFIG_PROPERTY_VALUE;
|
||||
import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_PREFIX;
|
||||
|
||||
/**
|
||||
* Dubbo {@link ConfigurationProperties Config Properties} only used to generate JSON metadata(non-public class)
|
||||
* Dubbo {@link ConfigurationProperties Config Properties} only used to generate JSON metadata (non-public class)
|
||||
*
|
||||
* @see ConfigKeys
|
||||
* @since 2.7.1
|
||||
*/
|
||||
@ConfigurationProperties(DUBBO_PREFIX)
|
||||
@ConfigurationProperties("dubbo")
|
||||
public class DubboConfigurationProperties {
|
||||
|
||||
@NestedConfigurationProperty
|
||||
private Config config = new Config();
|
||||
|
||||
@NestedConfigurationProperty
|
||||
private Scan scan = new Scan();
|
||||
|
||||
// Single Config Bindings
|
||||
/**
|
||||
* Configuration properties for the application.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private ApplicationConfig application = new ApplicationConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for the module.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private ModuleConfig module = new ModuleConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for the registry.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private RegistryConfig registry = new RegistryConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for the protocol.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private ProtocolConfig protocol = new ProtocolConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for the monitor.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private MonitorConfig monitor = new MonitorConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for the provider.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private ProviderConfig provider = new ProviderConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for the consumer.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private ConsumerConfig consumer = new ConsumerConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for the config center.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private ConfigCenterBean configCenter = new ConfigCenterBean();
|
||||
private ConfigCenterConfig configCenter = new ConfigCenterConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for the metadata report.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private MetadataReportConfig metadataReport = new MetadataReportConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for metrics.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private MetricsConfig metrics = new MetricsConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for tracing.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private TracingConfig tracing = new TracingConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for ssl.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private SslConfig ssl = new SslConfig();
|
||||
|
||||
/**
|
||||
* Configuration properties for rpc.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private RpcConfig rpc = new RpcConfig();
|
||||
|
||||
// Multiple Config Bindings
|
||||
|
||||
/**
|
||||
* Multiple configurations for Module.
|
||||
*/
|
||||
private Map<String, ModuleConfig> modules = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Multiple configurations for Registry.
|
||||
*/
|
||||
private Map<String, RegistryConfig> registries = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Multiple configurations for Protocol.
|
||||
*/
|
||||
private Map<String, ProtocolConfig> protocols = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Multiple configurations for Monitor.
|
||||
*/
|
||||
private Map<String, MonitorConfig> monitors = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Multiple configurations for Provider.
|
||||
*/
|
||||
private Map<String, ProviderConfig> providers = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Multiple configurations for Consumer.
|
||||
*/
|
||||
private Map<String, ConsumerConfig> consumers = new LinkedHashMap<>();
|
||||
|
||||
private Map<String, ConfigCenterBean> configCenters = new LinkedHashMap<>();
|
||||
/**
|
||||
* Multiple configurations for ConfigCenterBean.
|
||||
*/
|
||||
private Map<String, ConfigCenterConfig> configCenters = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Multiple configurations for MetadataReportConfig.
|
||||
*/
|
||||
private Map<String, MetadataReportConfig> metadataReports = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Multiple configurations for MetricsConfig.
|
||||
*/
|
||||
private Map<String, MetricsConfig> metricses = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Multiple configurations for TracingConfig.
|
||||
*/
|
||||
private Map<String, TracingConfig> tracings = new LinkedHashMap<>();
|
||||
|
||||
public Config getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public void setConfig(Config config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public Scan getScan() {
|
||||
return scan;
|
||||
}
|
||||
|
||||
public void setScan(Scan scan) {
|
||||
this.scan = scan;
|
||||
}
|
||||
|
||||
public ApplicationConfig getApplication() {
|
||||
return application;
|
||||
}
|
||||
|
|
@ -186,11 +231,11 @@ public class DubboConfigurationProperties {
|
|||
this.consumer = consumer;
|
||||
}
|
||||
|
||||
public ConfigCenterBean getConfigCenter() {
|
||||
public ConfigCenterConfig getConfigCenter() {
|
||||
return configCenter;
|
||||
}
|
||||
|
||||
public void setConfigCenter(ConfigCenterBean configCenter) {
|
||||
public void setConfigCenter(ConfigCenterConfig configCenter) {
|
||||
this.configCenter = configCenter;
|
||||
}
|
||||
|
||||
|
|
@ -218,6 +263,22 @@ public class DubboConfigurationProperties {
|
|||
this.tracing = tracing;
|
||||
}
|
||||
|
||||
public SslConfig getSsl() {
|
||||
return ssl;
|
||||
}
|
||||
|
||||
public void setSsl(SslConfig ssl) {
|
||||
this.ssl = ssl;
|
||||
}
|
||||
|
||||
public RpcConfig getRpc() {
|
||||
return rpc;
|
||||
}
|
||||
|
||||
public void setRpc(RpcConfig rpc) {
|
||||
this.rpc = rpc;
|
||||
}
|
||||
|
||||
public Map<String, ModuleConfig> getModules() {
|
||||
return modules;
|
||||
}
|
||||
|
|
@ -266,11 +327,11 @@ public class DubboConfigurationProperties {
|
|||
this.consumers = consumers;
|
||||
}
|
||||
|
||||
public Map<String, ConfigCenterBean> getConfigCenters() {
|
||||
public Map<String, ConfigCenterConfig> getConfigCenters() {
|
||||
return configCenters;
|
||||
}
|
||||
|
||||
public void setConfigCenters(Map<String, ConfigCenterBean> configCenters) {
|
||||
public void setConfigCenters(Map<String, ConfigCenterConfig> configCenters) {
|
||||
this.configCenters = configCenters;
|
||||
}
|
||||
|
||||
|
|
@ -298,64 +359,23 @@ public class DubboConfigurationProperties {
|
|||
this.tracings = tracings;
|
||||
}
|
||||
|
||||
static class Config {
|
||||
/**
|
||||
* Configuration for rpc.
|
||||
*/
|
||||
public static class RpcConfig {
|
||||
|
||||
/**
|
||||
* Config processing mode
|
||||
* @see ConfigMode
|
||||
* The triple config.
|
||||
*/
|
||||
private ConfigMode mode = ConfigMode.STRICT;
|
||||
@NestedConfigurationProperty
|
||||
private TripleConfig tri;
|
||||
|
||||
/**
|
||||
* Indicates multiple properties binding from externalized configuration or not.
|
||||
*/
|
||||
private boolean multiple = DEFAULT_MULTIPLE_CONFIG_PROPERTY_VALUE;
|
||||
|
||||
/**
|
||||
* The property name of override Dubbo config
|
||||
*/
|
||||
private boolean override = DEFAULT_OVERRIDE_CONFIG_PROPERTY_VALUE;
|
||||
|
||||
public boolean isOverride() {
|
||||
return override;
|
||||
public TripleConfig getTri() {
|
||||
return tri;
|
||||
}
|
||||
|
||||
public void setOverride(boolean override) {
|
||||
this.override = override;
|
||||
}
|
||||
|
||||
public boolean isMultiple() {
|
||||
return multiple;
|
||||
}
|
||||
|
||||
public void setMultiple(boolean multiple) {
|
||||
this.multiple = multiple;
|
||||
}
|
||||
|
||||
public ConfigMode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public void setMode(ConfigMode mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
static class Scan {
|
||||
|
||||
/**
|
||||
* The basePackages to scan , the multiple-value is delimited by comma
|
||||
*
|
||||
* @see EnableDubbo#scanBasePackages()
|
||||
*/
|
||||
private Set<String> basePackages = new LinkedHashSet<>();
|
||||
|
||||
public Set<String> getBasePackages() {
|
||||
return basePackages;
|
||||
}
|
||||
|
||||
public void setBasePackages(Set<String> basePackages) {
|
||||
this.basePackages = basePackages;
|
||||
public void setTri(TripleConfig tri) {
|
||||
this.tri = tri;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
# About dubbo-spring-boot-configuration-metadata-compatible module
|
||||
|
||||
## Why
|
||||
|
||||
Configuration beans of dubbo are located in the `dubbo-common` module, and it's not suitable to add spring boot dependencies.
|
||||
However, spring configuration metadata generation relies on read javadoc from the source code and cannot use the @NestedConfigurationProperty annotation.
|
||||
This leads to missing comments and a lack of nested configuration options. Therefore, we use an independent module to copy the code and generate metadata.
|
||||
|
||||
## Principles
|
||||
|
||||
1. Copy classes under `org/apache/dubbo/config` from `dubbo-common` to the `generated-sources` directory.
|
||||
2. Replace `@Nest` with `@NestedConfigurationProperty`.
|
||||
3. Copy the class `DubboConfigurationProperties.java` from `autoconfigure` to the `generated-sources` directory.
|
||||
4. Use an annotation-only option to compile and generate `spring-configuration-metadata.json`.
|
||||
5. During `autoconfigure` module compilation, will read `spring-configuration-metadata.json` from this module.
|
||||
|
||||
## How to add a new configuration option
|
||||
|
||||
- For standard configuration options, add javadoc to the corresponding configuration classes in `dubbo-common`.
|
||||
- For non-standard configuration options, there are unnecessary to add nested classes. add them directly to `additional-spring-configuration-metadata.json`.
|
||||
|
||||
## Configuration Javadoc Guideline
|
||||
|
||||
1. For noun-type configuration options, use "The xxx" format for comments.
|
||||
2. For boolean-type configuration options, use "Whether to xxx" format and add ", default value is <code>true</code>" at the end.
|
||||
3. For configuration options with longer comments, use multi-line comments, with a clear summary in the first line.
|
||||
4. All comments should end with a period.
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-spring-boot-compatible</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>dubbo-spring-boot-configuration-metadata-compatible</artifactId>
|
||||
|
||||
<properties>
|
||||
<skip_maven_deploy>true</skip_maven_deploy>
|
||||
<sources_directory>${project.build.directory}/generated-sources/java</sources_directory>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>get-version-infos</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-sources</id>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<delete dir="${sources_directory}" quiet="true"/>
|
||||
<copy todir="${sources_directory}">
|
||||
<fileset dir="../../../dubbo-common/src/main/java">
|
||||
<include name="org/apache/dubbo/config/**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<replace token="@Nested" value="@org.springframework.boot.context.properties.NestedConfigurationProperty">
|
||||
<fileset dir="${sources_directory}">
|
||||
<include name="**/*.java"/>
|
||||
</fileset>
|
||||
</replace>
|
||||
<copy todir="${sources_directory}">
|
||||
<fileset dir="../autoconfigure/src/main/java">
|
||||
<include name="**/DubboConfigurationProperties.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>clean-sources</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<delete dir="${sources_directory}" quiet="true"/>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${sources_directory}</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<proc>only</proc>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipSource>true</skipSource>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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.dubbo.spring.boot.autoconfigure;
|
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(DubboConfigurationProperties.class)
|
||||
public class DubboMetadataGenerateAutoConfiguration {
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"properties": [
|
||||
{
|
||||
"name": "dubbo.enabled",
|
||||
"description": "Whether enable autoconfiguration of dubbo, default value is <code>true</code>.",
|
||||
"type": "java.util.Set<java.lang.String>"
|
||||
},
|
||||
{
|
||||
"name": "dubbo.labels",
|
||||
"description": "The labels for these service providers, enabling categorization and grouping, thereby enhancing their management and monitoring, the multiple-value is delimited by ';'.",
|
||||
"type": "java.lang.String"
|
||||
},
|
||||
{
|
||||
"name": "dubbo.env.keys",
|
||||
"description": "The keys for specify environment-specific keys, allowing for differentiation and utilization of various runtime environments (e.g., development, testing, production), the multiple-value is delimited by comma.",
|
||||
"type": "java.lang.String"
|
||||
},
|
||||
{
|
||||
"name": "dubbo.config.override",
|
||||
"description": " Whether to allow configuration override in Dubbo, default value is <code>true</code>.",
|
||||
"type": "java.lang.Boolean"
|
||||
},
|
||||
{
|
||||
"name": "dubbo.config.multiple",
|
||||
"description": "Whether to enable multiple configurations in Dubbo, allowing multiple configurations to be loaded and used, default value is <code>true</code>.",
|
||||
"type": "java.lang.Boolean"
|
||||
},
|
||||
{
|
||||
"name": "dubbo.config.mode",
|
||||
"description": "Config processing mode. See <code>org.apache.dubbo.config.context.ConfigMode</code>.",
|
||||
"type": "org.apache.dubbo.config.context.ConfigMode"
|
||||
},
|
||||
{
|
||||
"name": "dubbo.config-center.include-spring-env",
|
||||
"description": "Whether to include Spring Environment.",
|
||||
"type": "java.lang.Boolean"
|
||||
},
|
||||
{
|
||||
"name": "dubbo.scan.base-packages",
|
||||
"description": "The basePackages to scan, the multiple-value is delimited by comma @see EnableDubbo#scanBasePackages().",
|
||||
"type": "java.util.Set<java.lang.String>"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@
|
|||
<modules>
|
||||
<module>autoconfigure</module>
|
||||
<module>actuator</module>
|
||||
<module>metadata</module>
|
||||
</modules>
|
||||
|
||||
<profiles>
|
||||
|
|
|
|||
Loading…
Reference in New Issue