quickstart/

directory
v1.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more

README

gRPC-Go-Polaris QuickStart example

English | 简体中文

Provide consumer and provider applications which based on gRPC framework, to show how to make gRPC application access polaris rapidly.

Content

  • provider: gRPC server application, demo service register, deregister, heartbeat.
  • consumer: gRPC client application, demo service discovery, and load balance.

Instruction

Configuration

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}

How to build

Build provider with go mod:

cd provider
go build -o provider

Build consumer with go mod:

cd consumer
go build -o consumer

Start application

Start Provider

go mod compile and build:

cd provider
go build -o provider

run binary executable:

./provider
Start Consumer

go mod compile and build:

cd consumer
go build -o consumer

run binary executable:

./consumer
Verify
Check polaris console

Login into polaris console, and check the instances in Service EchoServerGRPC.

Invoke by http call

Invoke http call,replace ${app.port} to the consumer port (16011 by default).

curl -L -X GET 'http://localhost:47080/quickstart/feign?msg=hello_world''

expect:echo: hello_world

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL