proto-service-mesh-ruby
proto-service-mesh-ruby is the Ruby implementation of the
Proto Service Mesh API.
It carries protobuf messages over any transport that implements the
Service Mesh API Specification
through the Ruby contract in the service_mesh gem, from
service-mesh-ruby.
The ProtoServiceMesh module holds the specification's non-generated types:
TransportRouterRegistryRPCRuntimeMeshError
It also holds the two base classes that generated code builds on:
RPCServiceRPCClient
Generated code comes from proto-service-mesh-gen in the specification
repository and lives in a definitions project.
Install
# Gemfile
gem "proto_service_mesh"Requires Ruby 3.3 or newer. The gem depends on service_mesh,
google-protobuf, and googleapis-common-protos-types. The last of these
provides Google::Rpc::Status, Google::Rpc::Code, and the detail types in
google/rpc/error_details.proto.
No transport is a dependency. The application adds the transport gem it uses.
Usage
An application uses this library through the generated code that depends on it. The
Proto Service Mesh API describes how Ruby code is
generated from .proto files.
Reference Examples
The examples in these docs use the reference definitions in spec/support/definitions/. They declare
shop.OrderService, with a ROUTE method Place and a TOPIC method Placed, in deployment group shop over the
transport named mem, the in-memory transport the specs use. The generated module is Shop, and the generated
per-transport maps are in ServiceMaps. The generated code is in spec/support/testproto/, written by
proto-service-mesh-gen as a consumer would generate it, and described under Generated Code.
Documentation
-
Setup: configuring the
TransportRouter, registering services, and running anRPCRuntime -
Handlers: implementing an
RPCService, endpoint and subscriber handlers, returning errors, reply metadata, and message metadata - Calling: calling generated clients, metadata and transport options, reply metadata, and the wire format
-
MeshError: constructing and reading
MeshError, and the errors the library raises - Generated Code: the generated reference output for Ruby, and what generated code relies on in this library
-
Public API: every public constant and method in
ProtoServiceMesh - Development: the specification protos, the recipes, and the tests