MyGit

polarismesh/grpc-java-polaris

Fork: 19 Star: 11 (更新于 2024-12-08 15:54:37)

license: NOASSERTION

Language: Java .

gRPC-Java integrates with Polaris Service Discovery and Governance

最后发布版本: v1.1.0 ( 2023-03-31 17:00:42)

GitHub网址

gRPC-Java-Polaris

codecov

English | 简体中文

Introduction

gRPC-Java-Polaris is a service management component based on the Grpc extension, which is convenient for developers who use Grpc to quickly access polaris and use the functions of service registration, load balancing, fusing, and current limiting provided by polaris.

Catalog Introduction

  • grpc-java-polaris        Core code based on Grpc extended functions
  • grpc-java-polaris-example    Get started quickly with the use case of grpc-java-polaris

How To Use

Source installation

Copy the following command to clone the source code to the local:

git clone https://github.com/polarismesh/grpc-java-polaris.git

Then execute the install command to install the grpc-java-polaris project to the local maven warehouse:

mvn clean install -U -Dmaven.test.skip=true

Use

Add grpc-java-polaris dependency to the developed Grpc project:

<dependency>
   <groupId>com.tencent.polaris</groupId>
   <artifactId>grpc-java-polaris</artifactId>
   <version>${grpc-java-polaris.version}</version>
</dependency>

The server uses the PolarisGrpcServer provided by the grpc-java-polaris package to create a grpc server. PolarisGrpcServer internally encapsulates service registration, heartbeat logic, etc:

PolarisGrpcServer polarisGrpcServer = PolarisGrpcServer.builder()
        .port(50051)
        .namespace("default")
        .applicationName("grpc-demo-java")
        .metadata(null)
        .bindableServices(services)
        .build();
        
polarisGrpcServer.start();

The client need replace the ManagedChannelBuilder to PolarisManagedChannelBuilder:

ManagedChannel channel = PolarisManagedChannelBuilder.forTarget("polaris://grpc-demo-java:8080?namespace=default")
        .usePlaintext().build();

Examples

最近版本更新:(数据更新于 2024-10-11 10:54:16)

2023-03-31 17:00:42 v1.1.0

2022-06-09 14:29:20 v1.1.0-SNAPSHOT

2021-12-17 19:53:21 v1.0.0

主题(topics):

grpc-java, polaris-java, polarismesh

polarismesh/grpc-java-polaris同语言 Java最近更新仓库

2024-12-20 19:54:15 mybatis-flex/mybatis-flex

2024-12-19 21:53:46 spring-projects/spring-boot

2024-12-19 21:25:16 Stirling-Tools/Stirling-PDF

2024-12-19 16:28:14 Tornaco/Thanox

2024-12-19 10:42:01 alibaba/nacos

2024-12-18 20:58:34 dromara/forest