English | 简体中文
Provide examples of applications developed based on the gRPC framework (including consumer and provider applications), and demonstrate how applications developed using the gRPC framework can quickly connect to Polaris.
- provider: gRPC server application, demo service register, deregister, heartbeat.
- consumer: gRPC client application, demo service discovery, and load balance.
Modify polaris.yaml in provider and consumer, which is showed as below: besides, ${ip} and ${port} is the address of polaris server.
global:
serverConnector:
addresses:
- ${ip}:${port}
Maven compilation and packaging:
cd provider
mvn clean package -U -Dmaven.test.skip=true
Then run the compiled jar package:
java -jar quickstart-provider-1.0.0-SNAPSHOT.jar
Maven compilation and packaging:
cd consumer
mvn clean package -U -Dmaven.test.skip=true
Then run the compiled jar package:
java -jar quickstart-consumer-1.0.0-SNAPSHOT.jar
Login into polaris console, and check the instances in Service grpc-demo-java
Invoke http call,replace ${app.port} to the consumer port (40041 by default).
curl -X GET 'http://localhost:40041/polaris/grpc/quickstart/consumer?value="hello-polaris'
expect:hello-polaris