Seven Demos dubbo user guider notes of ---- Explicit target (direct connection to the specified Provider)

Explicit target

Development and testing environment, usually need to bypass the registration center, directly connected to the service provider designated for testing. In this case, a direct point to point connection is required, the service provider will ignore provide a list of registered providers. A configuration of the interface point to point, without impacting the interface B to get a list from the registry.

image

Configure with XML

If the demand is need-point line feature, you can That configuration url specified provider. It will bypass the registry direct requests among a plurality of addresses with [;] separated, for example:

<dubbo:reference id="xxxService" interface="com.alibaba.xxx.XxxService" url="dubbo://localhost:20890" />

Configure with the -D argument

In the JVM startup parameters plus -D parameter mapping service address:

java -Dcom.alibaba.xxx.XxxService=dubbo://localhost:20890

Configure with the .properties file

If your service a lot, you can also use -Ddubbo.resolve.file parameter to specify the mapping file path. This configuration takes precedence <dubbo: reference> in the configuration, for example:

java -Ddubbo.resolve.file=xxx.properties

Then, in xxx.properties added to the configuration information file, key is the service name, value is the url of the service provider

com.alibaba.xxx.XxxService=dubbo://localhost:20890

Note: In order to avoid complicating the online environment, do not use this feature online environment, should be used only in the testing phase.

Guess you like

Origin www.cnblogs.com/po-shi/p/11262554.html