Nitro Examples
This is a repository for Nitro examples. Feel free to contribute.
Contents
- broker - A example of using Broker for Publish and Subscribing.
- client - Usage of the Client package to call a service.
- config - Using Go Config for dynamic config
- graceful - Demonstrates graceful shutdown of a service
- helloworld - Hello world using micro
- noproto - Use micro without protobuf or code generation, only go types
- options - Setting options in the go-micro framework
- server - Use of the Server package directly to server requests.
- service - Example of the top level Service in go-micro.
- sharding - An example of how to shard requests or use session affinity
- shutdown - Demonstrates graceful shutdown via context cancellation
- stream - An example of a streaming service and client
- waitgroup - Demonstrates how to use a waitgroup with a service
Install
Install protoc for your environment. Then:
# install protoc-gen-go
go get github.com/golang/protobuf/{proto,protoc-gen-go}
# install protoc-gen-micro
go get github.com/micro/micro/v2/cmd/protoc-gen-micro@master
To recompile any proto after changes:
protoc --proto_path=$GOPATH/src:. --micro_out=. --go_out=. path/to/proto