Skip to content

Latest commit

 

History

History
105 lines (75 loc) · 4.28 KB

README.md

File metadata and controls

105 lines (75 loc) · 4.28 KB

gRPC Starter

Build Maven Central License: MIT

Documentation

Overview

This project provides out-of-the-box, highly scalable Spring Boot starters for the cutting-edge ecosystem of gRPC.

Make the integration of gRPC with Spring Boot feel seamless and native.

Features

Core:

Extensions:

Quick Start

implementation(platform("io.github.danielliu1123:grpc-starter-dependencies:3.2.5"))
implementation("io.github.danielliu1123:grpc-boot-starter")

From version 3.2.0, the groupId of the project has been changed to io.github.danielliu1123 from com.freemanan.

@SpringBootApplication
public class SimpleApp extends SimpleServiceGrpc.SimpleServiceImplBase {

    public static void main(String[] args) {
        new SpringApplicationBuilder(SimpleApp.class)
                .properties("grpc.client.base-packages=io.grpc")
                .properties("grpc.client.authority=127.0.0.1:9090")
                .run(args);
    }

    @Override
    public void unaryRpc(SimpleRequest request, StreamObserver<SimpleResponse> responseObserver) {
        SimpleResponse response = SimpleResponse.newBuilder()
                .setResponseMessage("Hello " + request.getRequestMessage())
                .build();
        responseObserver.onNext(response);
        responseObserver.onCompleted();
    }

    @Bean
    ApplicationRunner runner(SimpleServiceGrpc.SimpleServiceBlockingStub stub) {
        return args -> {
            SimpleResponse response = stub.unaryRpc(SimpleRequest.newBuilder().setRequestMessage("World!").build());
            System.out.println(response.getResponseMessage());
        };
    }

}

See the example project。

Version

Mainly maintain the following versions:

  • 3.x

    Based on Spring Boot 3, baseline is JDK 17, the corresponding branch is main.

    3.x version is kept in sync with Spring Boot 3, if you are using Spring Boot 3.2.x, then grpc-boot-starter 3.2.5 should be used.

    Spring Boot grpc-boot-starter
    3.1.x 3.1.8
    3.2.x 3.2.5
  • 2.x

    Based on Spring Boot 2, baseline is JDK 8, the corresponding branch is 2.x

    Spring Boot grpc-boot-starter
    2.x 2.1.6

License

The MIT License.