Dubbo provides the service governance capability of dynamically creating conditional routing, which can route according to the request initiator and method without restarting the application.
Dubbo can implement dynamic routing according to request conditions through XML configuration, annotation configuration, and dynamic configuration. Here we mainly introduce the dynamic configuration method. For other configuration methods, please refer to the old document Configuration
Please make sure to run Dubbo-Admin successfully
In business scenarios such as black and white lists, excluding pre-release machines, exposing only some machines, and isolation by environment, routing rules are required to filter the target server address before initiating an RPC call, and the filtered address is used as the candidate address for the final RPC call. Dubbo-Admin provides conditional routing capabilities, which can help you configure routing rules to meet business scenarios.
---
scope: application/service
force: true
runtime: true
enabled: true
key: app-name/group+service+version
conditions:
- application=app1 => address=*:20880
- method=sayHello => address=*:20880
For conditional routing scenarios, you only need to clarify the following questions to know how to write the configuration:
scope: application, key: app-name
(you can also use services
to specify certain services).scope: service, key:group+service+version
.addresses: ["0.0.0.0"]
or addresses: ["0.0.0.0:*"]
depends on the side value.addersses[list of instance addresses]
.Select the application related to the conditional routing configuration to trigger the call verification.