Tutorial: gRPC service
เนื้อหานี้ยังไม่ได้แปลเป็นภาษาไทย แสดงเป็นภาษาอังกฤษแทน
Cephalon.AspNetCore.Grpc is the transport adapter for gRPC. It handles unary and streaming methods, plugs into the same behavior pipeline as REST, and integrates with the host’s observability stack so traces propagate across the wire.
What you’ll build
Section titled “What you’ll build”- a gRPC service exposing
GetProduct(unary) andWatchInventory(server streaming). - a proto contract shared between the service and a client console app.
- mutual TLS via the included Kubernetes deploy script.
- traces that flow from the calling client through the gRPC server into the database.
Skeleton recipe
Section titled “Skeleton recipe”<PackageReference Include="Cephalon.AspNetCore.Grpc" />builder.Services .AddCephalonAspNetCore(options => options.EnableGrpc()) .AddModulesFromAssemblies(/* ... */);public sealed class ProductsGrpcModule : GrpcBehaviorModuleBase{ public override ModuleDescriptor Describe() => new("Acme.Store.Grpc.Products", "1.0.0", [Capability.Data]);
protected override void ConfigureGrpcServices(IGrpcBehaviorBuilder builder) { builder.MapService<ProductsGrpcService>(); }}Status
Section titled “Status”The full step-by-step walkthrough is part of the next docs push. In the meantime:
- the host adapter’s surface lives at Source → components / aspnetcore-grpc + the Technology → Hosts catalog.
- protobuf authoring conventions are in the Engineering standards.
- the First-app tutorial explains the behavior pipeline, which works the same for gRPC.