Tonic: 0.2 release with the future in mind!
After a few months of work we finally have released
tonic 0.2. This
release marks the start of a new path for
tonic was a wrapper around
prost providing a
good out of the box experience for protobuf based gRPC services. With 0.2
still provides a great out of box experience for protobuf but now also
supports other encoding formats!
tonic has always supported custom codecs
tonic::codec::Codec trait but codegen would always tie directly to
prost. Which means that if you wanted to write a custom codec you would have
to manually replicate what
tonic-build does. This is no longer true as we now
have traits that can be implemented within
tonic-build to guide codegen in the
In the future,
tonic will also provide support for flatbuffers via the new
tonic 0.2 supports the groundwork for this
and we will create an accompanying crate that will provide all the types you need
in the future.
Another common feature request has been providing a way to support gRPC
healthchecks. After some work @jen20 has implemented the
crate which provides support for server side health reporting.
let (mut health_reporter, health_service) = tonic_health::server::health_reporter(); // Set our Greeter service to serving. health_reporter .set_serving::<GreeterServer<MyGreeter>>() .await; // Add healthcheck service to our router Server::builder() .add_service(health_service) .add_service(GreeterServer::new(greeter)) .serve(addr) .await?;
Example can be found here.
Thanks to all the wonderful contributors for helping get this release over the finish line. As always, there is a changelog and an issue tracker if you run into any issues. Please, feel welcome to also join us on discord if you need any help!