Skip to content

go-orb/examples

Repository files navigation

go-orb/examples

Contains examples and benchmarks for go-orb.

Available examples

A benchmark for running RPC requests over the event plugins, currently theres only the natsjs backend.

A benchmark for running requests-per-second (rps) for a go-orb/server.

The rps benchmark sends X bytes (default 1000) to server which echoes it to the client.

See the WIKI for results.

A example on howto run multiple services in a monolith.

A simple example of RPC requests over the event plugins, currently theres only the natsjs backend.

An advanced example which shows howto build a multi-service app that is also able to run as monolith.

This example uses httpgateway to forward requests.

It is the latest and greatest example and we will work on extending it.

A simple example of a go-orb service and client with an auth REST API.

This example doesn't utilize the go-orb config system, just to show it's possible to configure a go-orb service without it. It has the smallest binary size of all examples.

A simple example of a go-orb service and client with a REST middleware.

In it's config folder you can find a variaty of config files for different transports as well as logging options and registries. All of them run with the same code/binary.

Run the server with:

go run ./cmd/server/... --config ./config/grpc.yaml

And the client with:

go run ./cmd/client/... --config ./config/grpc.yaml

Running

To run an example you need to have go1.23.6 or later installed. You can get it with gvm.

All the examples have a cmd folder you can run it with go run "./cmd/handler/...".

You can run all examples at once by running ./scripts/test.sh, this is what we do in CI.

Development

You need:

  • go1.23.6 or later
  • docker for dagger
  • our custom fork of wire go install github.com/go-orb/wire/cmd/wire@latest
  • protoc-gen-go go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
  • protoc-gen-go-orb go install github.com/go-orb/plugins/server/cmd/protoc-gen-go-orb@latest

Now you'r able to run go generate ./... in the examples to update cmd/xyz/wire_gen.go as well as the proto files.

Authors

go-orb

License

go-orb is Apache 2.0 licensed and is based on go-micro.

Releases

No releases published

Packages

No packages published