https://github.com/ekomobile/grpc-consul-resolver
gRPC Consul resolver
https://github.com/ekomobile/grpc-consul-resolver
consul grpc grpc-consul-resolver
Last synced: 2 months ago
JSON representation
gRPC Consul resolver
- Host: GitHub
- URL: https://github.com/ekomobile/grpc-consul-resolver
- Owner: ekomobile
- License: mit
- Created: 2018-05-03T07:56:47.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-08T15:16:49.000Z (over 5 years ago)
- Last Synced: 2025-08-15T03:54:28.588Z (8 months ago)
- Topics: consul, grpc, grpc-consul-resolver
- Language: Go
- Size: 28.3 KB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/ekomobile/grpc-consul-resolver)
[](https://github.com/ekomobile/grpc-consul-resolver/releases)
[](https://goreportcard.com/report/github.com/ekomobile/grpc-consul-resolver)

[](https://godoc.org/github.com/ekomobile/grpc-consul-resolver)
# gRPC Consul resolver
This lib resolves Consul services by name.
# Usage
Somewhere in your `init` code:
```go
import (
"github.com/ekomobile/grpc-consul-resolver"
)
// Will query consul every 5 seconds.
resolver.RegisterDefault(time.Second * 5)
```
Getting connection:
```go
conn, err := grpc.DialContext(ctx, "srv://consul/my-awesome-service")
```
With round-robin balancer:
```go
import (
"google.golang.org/grpc/balancer/roundrobin"
)
conn, err := grpc.DialContext(ctx, "srv://consul/my-awesome-service", grpc.WithBalancerName(roundrobin.Name))
```