Mediarq.Grpc
1.5.1
dotnet add package Mediarq.Grpc --version 1.5.1
NuGet\Install-Package Mediarq.Grpc -Version 1.5.1
<PackageReference Include="Mediarq.Grpc" Version="1.5.1" />
<PackageVersion Include="Mediarq.Grpc" Version="1.5.1" />
<PackageReference Include="Mediarq.Grpc" />
paket add Mediarq.Grpc --version 1.5.1
#r "nuget: Mediarq.Grpc, 1.5.1"
#:package Mediarq.Grpc@1.5.1
#addin nuget:?package=Mediarq.Grpc&version=1.5.1
#tool nuget:?package=Mediarq.Grpc&version=1.5.1
Mediarq.Grpc
gRPC transport for cross-service Mediarq notifications: forward a notification to another service's
Mediarq gRPC endpoint when it is published, and receive it back into the real Mediarq pipeline via a
single shared gRPC service. Ships its own compiled Protobuf/gRPC contract — reference this package only,
no protoc/Grpc.Tools required on your side.
dotnet add package Mediarq.Grpc
Marking an event
public sealed record OrderPlaced(Guid OrderId, string Customer) : IGrpcNotificationEvent
{
public static string ServiceAddress => "https://order-service:5001";
}
ServiceAddress is a static abstract member, not an instance property: the publish side needs this
routing information available before any OrderPlaced instance exists, and reading it from the type
rather than an instance keeps it impossible for two instances of the same notification type to
accidentally target different remote services.
Publishing (outbound)
builder.Services.AddMediarqGrpcPublisher<OrderPlaced>();
Now every IPublisher.Publish(new OrderPlaced(...)) call also calls OrderPlaced.ServiceAddress's
NotificationService.Publish RPC, in addition to running any in-process handlers. The HTTP/2 channel to
each ServiceAddress is cached and reused (not one per publish) and disposed when the app shuts down —
unlike the Dapr/RabbitMQ/Azure Service Bus packages, this package owns that channel's lifecycle itself,
since (unlike a Dapr sidecar client, a RabbitMQ connection, or a Service Bus client) it carries no
external credentials your app needs to configure.
Subscribing (inbound)
builder.Services.AddMediarqGrpcSubscriptions();
// ...
app.MapMediarqGrpcNotificationService(); // map exactly once
app.MapMediarqGrpcSubscription<OrderPlaced>();
Every subscribed notification type is multiplexed over the single shared gRPC service — there is one RPC
method (Publish), and the envelope's type_name field tells the receiving service which registered
type to deserialize the JSON payload as and republish through IPublisher. A gRPC call for a type that
was never subscribed on this service fails with StatusCode.NotFound.
What this does not do
Unlike a message broker (Dapr pub/sub, RabbitMQ, Azure Service Bus), gRPC is direct point-to-point RPC:
the publisher must know the target service's network address, there is no fan-out, no persistence, and
no retry/redelivery if the remote service is unreachable — a failed Publish RPC throws
Grpc.Core.RpcException, same as any other Mediarq notification handler exception. If you need broker
semantics (decoupled publisher/subscriber, delivery guarantees, dead-lettering), use one of the other
transport packages instead.
Learn more
Wiring extensions · Full README · gRPC for .NET docs
MIT © Nicolas Rouffart
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Google.Protobuf (>= 3.35.1)
- Grpc.AspNetCore.Server (>= 2.80.0)
- Grpc.Net.Client (>= 2.80.0)
- Mediarq.Core (>= 1.5.1)
-
net8.0
- Google.Protobuf (>= 3.35.1)
- Grpc.AspNetCore.Server (>= 2.80.0)
- Grpc.Net.Client (>= 2.80.0)
- Mediarq.Core (>= 1.5.1)
-
net9.0
- Google.Protobuf (>= 3.35.1)
- Grpc.AspNetCore.Server (>= 2.80.0)
- Grpc.Net.Client (>= 2.80.0)
- Mediarq.Core (>= 1.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.