ShipitSmarter.Core.Messaging.Subscriber
8.0.22-20240311145707.pr51.sha-cbb10ea
See the version list below for details.
dotnet add package ShipitSmarter.Core.Messaging.Subscriber --version 8.0.22-20240311145707.pr51.sha-cbb10ea
NuGet\Install-Package ShipitSmarter.Core.Messaging.Subscriber -Version 8.0.22-20240311145707.pr51.sha-cbb10ea
<PackageReference Include="ShipitSmarter.Core.Messaging.Subscriber" Version="8.0.22-20240311145707.pr51.sha-cbb10ea" />
paket add ShipitSmarter.Core.Messaging.Subscriber --version 8.0.22-20240311145707.pr51.sha-cbb10ea
#r "nuget: ShipitSmarter.Core.Messaging.Subscriber, 8.0.22-20240311145707.pr51.sha-cbb10ea"
// Install ShipitSmarter.Core.Messaging.Subscriber as a Cake Addin #addin nuget:?package=ShipitSmarter.Core.Messaging.Subscriber&version=8.0.22-20240311145707.pr51.sha-cbb10ea&prerelease // Install ShipitSmarter.Core.Messaging.Subscriber as a Cake Tool #tool nuget:?package=ShipitSmarter.Core.Messaging.Subscriber&version=8.0.22-20240311145707.pr51.sha-cbb10ea&prerelease
ShipitSmarter.Core.Messaging.Subscriber
Defines interfaces and implementations for receiving messages.
IMessageHandler
The client will require an implementation of the IMessageHandler
. The recommended way of implementing this interface is by creating a control flow based on the Message.Subject
:
public class MessageHandler : IMessageHandler
{
public MessageHandler(
// Inject handlers and other dependencies
)
public Task Handle(Message message) {
if (MyMessage.Subject == message.Subject) {
var myMessage = MyMessage.Deserialize(message);
return myMessageHandler.Handle(myMessage);
}
if (MyOtherMessage.Subject == message.Subject) {
var myOtherMessage = MyOtherMessage.Deserialize(message);
return myOtherMessageHandler.Handle(myOtherMessage);
}
...
}
}
GoogleSubscriberClient
The subscriber client is implemented as a BackgroundService
. You have to register it together with an implementation of IMessageHandler
, TMessageHandler
.
services.AddGoogleSubscriberClient<TMessageHandler>("project-id", "subscription-id");
Google Pub/Sub emulator
The client builder is setup to recognize and use emulator settings when they are set. See Testing apps locally with the emulator for more information.
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. |
-
net8.0
- Google.Cloud.PubSub.V1 (>= 3.9.1)
- Microsoft.Extensions.Hosting (>= 8.0.0)
- ShipitSmarter.Core (>= 8.0.22-20240311145707.pr51.sha-cbb10ea)
- ShipitSmarter.Core.Messaging (>= 8.0.22-20240311145707.pr51.sha-cbb10ea)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.