From RESTful API to gRPC
gRPC has been around for a while now, but never gained the first-class citizen title when it came to implementing a downstream API.
It is contract-based, performant - with smaller response/request bodies, perfect for polyglot environments and supports different models – from client-server to bi-directional streaming out of the box. If we sprinkle some client-side load balancing, transient fault-handling and the ability of exposing a gRPC service also as a HTTP API, we might the perfect point-to-point communication mechanism.
In this workshop you will learn the how and the whys and understand where gRPC fits in the .NET APIs ecosystem. At the end of the workshop you will be able to use gRPC in real production environments.
Topics covered:
Introduction
- What gRPC is and how it fits in an API context
- gRPC vs RESTful APIs
- gRPC vs WCF
Protocol Buffers
- working with .proto files
- understanding the syntax
- defining custom types
Working with gRPC
- the 4 gRPC modes
- Implementing and consuming gRPC services
- Documenting and exposing gRPC endpoints
gRPC internals
- Accessing the gRPC context
- Accessing the gRPC HTTP context
- Trailers
- Headers
- Status codes in gRPC
- Exceptions in gRPC
Transient fault-handling
- Defining policies
- Configuring a retry policy
- Configuring a hedging policy
Interceptors
- Client interceptors
- Server interceptors
- Configuring interceptors
- Interceptors vs Middleware
Client-side load balancing
- implementing a client-side load balancing
- Configuring client side load balancing
- load balancing policies
- Round-Robin
- Pick first
- Implementing our own policy
Transcoding
- what is is gRPC transcoding
- exposing our services as HTTP
- Consuming methods from the browser
- How routing works with gRPC transconding
- gRPC JSON transcoding vs gRPC-Web
- grpc-gateway - alternative to transcoding
Testing
- Testing with Postman
- Unit testing service operations
Health-checks
- Implementing health checks
Securing gRPC services
Documenting gRPC endpoints
Prerequisites
Attendees will require a laptop with the latest version on .NET SDK and their editor/IDE of choice: Visuals Studio 2022
Software Architect @Particular Software, Microsoft MVP for Developer Technologies, Microsoft Certified Trainer, always in a quest for the latest trends and best practices in architecture, .NET, and the world around it.
Irina has more than 1000 hours of delivered training, workshops, and presentations, is passionate about .NET and the world around it.
She is the founder of DotNet Iasi User Group where she tries to gather people who are willing to share their knowledge with others, and from time to time publishes articles on her blog: http://irina.codes