gRPC helper
gRPC helper is an improved gRPC client with lots of helpful features.
Getting Started
Installing
npm i grpc-helper --save
or
yarn add grpc-helper
Features
- Promised unary & client stream call
- Client Load balance
- Service health checking
- Service discovery (static, dns srv)
- Circuit breaker based on Brakes
- Retry based on async-retry
- Metrics for prometheus based on prom-client
- Highly custom options
Usage
DNS Service discovery
; await helper.waitForReady; ;
Static Service discovery
; await helper.waitForReady; ;
Resolve with full response
; await helper.waitForReady; ;
Client stream call
; ; stream.write; stream.write; stream.write; stream.end; ; // { message: 'hello foo1,foo2,foo3' }
Retry
; await helper.waitForReady; await helper.SayHello;
More
Please take a look at the test folder for more examples.
TODO
- Better api
- Doc
- Test code
- Retry on lb level when error
- Auto load proto when only one service available
- Consul/etcd/zk service discovery
License
This project is licensed under the MIT License - see the LICENSE file for details