gRPC Nacos registry integration
Go to file
敦谷 09fb4cb6a2 Update POM 2019-08-02 15:10:06 +08:00
grpc-java-registry-nacos refactor the package and project name 2019-07-31 12:53:31 +08:00
grpc-java-registry-nacos-example refactor the package and project name 2019-07-31 12:53:31 +08:00
.gitignore init commit 2019-05-16 21:42:01 +08:00
.travis.yml remove oracle jdk 8 2019-07-11 15:32:07 +08:00
LICENSE Initial commit 2019-05-16 10:42:16 +08:00
README.md trigger travis ci 2019-07-31 13:01:48 +08:00
mvnw maven 2019-07-10 21:34:35 +08:00
pom.xml Update POM 2019-08-02 15:10:06 +08:00

README.md

Nacos ECO project

Build Status

grpc-java-registry-nacos

this is common way of gRPC Nacos Java registry integration. Please feel free to add more features with this repo by sending pull requests and raising a issue.

Features

  • grpc client usage
  • grpc server builder and starter
  • integrate with Nacos
  • Automatic service registration and discovery
  • Round robin LoadBalancer which supported by gRPC

Requirements

Latest stable Apache Maven, Maven 3.2.5 or above. Note that this is build-time requirement.

Runtime requirement: JDK 8 is a recommend to run this application.

Building

You may clone this project and step into grpc-java-registry-nacos sub directory before read on.

# git clone https://github.com/nacos-group/grpc-java-registry-nacos
# cd grpc-java-registry-nacos

Run the following command to build the project(Java 1.8 is required to build the master branch).

  mvn clean install

Getting started by demo

Step 1: Start nacos server

Start a Nacos naming server is a must.

Step 2: Config for projects

Check the necessary config here You can copy this proto to your project. And do pay attention to the config usage.

`nacos_uri` means the uri of Nacos naming uri to register.
`grpc_nacos_port` means the port of Grpc server,which is needed by both server and client.

use `GrpcNacosOptions.getDescriptor().getOptions().getExtension(GrpcNacosProto.grpcNacosPort)` to get configuration of grpc port,
and `GrpcNacosOptions.getDescriptor().getOptions().getExtension(GrpcNacosProto.nacosUri)` represents the configuration of nacos registry url. 

Step 3: Start gRPC server

cd grpc-java-registry-nacos-example
mvn exec:java@server-demo

Step 4: Start gRPC client

mvn exec:java@client-demo

Step 5: Result

Calling result will be print out on the screen.

Next Steps

  • Golang will be supported when nacos-go-sdk provided.

  • More features welcome to be requested.

License

gRPC Nacos java is under the Apache 2.0 license. See the LICENSE file for details.