Dubbo Go & Polaris Registry Example

English | 中文

Using the service registration discovery function

Quickly experience Polaris' service registration and service discovery capabilities in dubbogo

Polaris server installation

Polaris Server Standalone Version Installation Documentation

Polaris Server Cluster Version Installation Documentation

how to use

dubbogo.yaml configuration file

Currently PolarisMesh has implemented the registration discovery extension point of dubbogo, so you only need to adjust the registries configuration item in your dubbogo.yaml file, and add the registry configuration of polaris as the protocol. You can refer to the following example.

dubbo:
  registries:
    polarisMesh:
      protocol: polaris
      address: ${Polaris server IP}:8091
      namespace: ${Polaris namespace information}
      token: ${Polaris resource authentication token} # If the Polaris server has enabled authentication for the client, you need to configure this parameter

Running the service provider

Enter the cmd directory of go-server and execute the following command

 export DUBBO_GO_CONFIG_PATH="../conf/dubbogo.yml"
 go run .

When you see the following log, it means that the server side started successfully

INFO dubbo/dubbo_protocol.go:84 [DUBBO Protocol] Export service:

Run the service caller

Enter the cmd directory of go-client and execute the following command

 export DUBBO_GO_CONFIG_PATH="../conf/dubbogo.yml"
 go run .

When you see the following log, it means that go-client successfully discovered go-server and made an RPC call

INFO cmd/main.go:75 response: &{A001 Alex Stocks 18 2022-11-19 12:52:38.092 +0800 CST}