Code Monkey home page Code Monkey logo

grpc-spring-boot-starter's Introduction

GRpc Spring Boot Starter

Circle CI codecov.io Codacy Badge Join the chat at https://gitter.im/lavcraft/grpc-spring-boot-starter Download

Usage

  • Add dependencies (see examples)
ru.alfalab.grpc.spring:starter
io.grpc:grpc-stub
io.grpc:grpc-protobuf
io.grpc:grpc-netty

example:

repositories {
  jcenter()
}

apply plugin: 'java'
apply plugin: 'com.google.protobuf'
apply plugin: 'org.springframework.boot'

dependencies {
  compile "ru.alfalab.grpc.spring:starter:$starterVersion"
  compile "io.grpc:grpc-stub:$grpcVersion"
  compile "io.grpc:grpc-protobuf:$grpcVersion"
  compile "io.grpc:grpc-netty:$grpcVersion"  
}
// see examples/example-isolated/build.gradle for details  
  • Add @EnableGRpcServer anotation to your configuration for enable grpc server
  • Customize configuration - application.yml/application.property. Example:
grpc:
 enabled: true
 servers:
   -
     address: 127.0.0.1
     port: 6565
   -
     address: 127.0.0.1
     port: 0

Use port: 0 for auto assign random port

or

    grpc.enabled: true
    grpc.servers[0].address=127.0.0.1
    grpc.servers[0].port=6565
    grpc.servers[0].address=127.0.0.1
    grpc.servers[0].port=0    

Default values

  • port 6565
  • host/ip localhost/127.0.0.1

Advanced features

Discover random port

If you want to run on random port (grpc.servers[0].port=0), you will need inject resulted port. Use @GRPCLocalPort please for solve this

@GRPCLocalPort
int port

Tested on

name version
io.grpc:grpc-stub 1.7.0
io.grpc:grpc-protobuf 1.7.0
io.grpc:grpc-netty 1.7.0
com.google.protobufprotoc 3.2.0
Spring Boot 1.5.8.RELEASE

grpc-spring-boot-starter's People

Contributors

gitter-badger avatar lavcraft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

grpc-spring-boot-starter's Issues

Question: We are not really 'talking' to endpoints provided by Spring-Boot?

Hi,
I'm new to gRPC and found this project via searching.
My first question would be:
We are not 'talking' to endpoints provided by the Spring-Boot app. Instead we are connecting to the 'embedded gRPC-Server' which is provided by Netty, right? Why do we need that wrapper when the communication is via Http. Does Spring-Boot or Tomcat not provide 'connectors' for that yet? What's with Jetty or Undertow, do they?

My second question:
Why would it be good thing to have multiple embedded servers running? At least I understand your starter in that way that it will spawn as many embedded servers as I configure. What do you had in mind when designing it that way. I found another 'grpc-spring-boot-starter' that does not go with multiple server-instances. Why did you so?

Regards
Jörg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.