From 4f7e057431999159a64f56d5eb1a6c6237529bde Mon Sep 17 00:00:00 2001 From: Raphael Strotz Date: Tue, 17 Oct 2023 13:19:38 +0200 Subject: [PATCH] Add .MessagesImplementing() to the docs about message routing --- docs/guide/messaging/subscriptions.md | 5 ++++- docs/guide/messaging/transports/tcp.md | 5 ++++- src/Samples/DocumentationSamples/StaticPublishingRule.cs | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/guide/messaging/subscriptions.md b/docs/guide/messaging/subscriptions.md index 032d1401a..386fbee0b 100644 --- a/docs/guide/messaging/subscriptions.md +++ b/docs/guide/messaging/subscriptions.md @@ -58,6 +58,9 @@ using var host = Host.CreateDefaultBuilder() rule.Message(); rule.Message(); + // Implementing a specific marker interface or common base class + rule.MessagesImplementing(); + // All types in a certain assembly rule.MessagesFromAssemblyContaining(); @@ -77,7 +80,7 @@ using var host = Host.CreateDefaultBuilder() opts.PublishAllMessages().ToPort(3333); }).StartAsync(); ``` -snippet source | anchor +snippet source | anchor Do note that doing the message type filtering by namespace will also include child namespaces. In diff --git a/docs/guide/messaging/transports/tcp.md b/docs/guide/messaging/transports/tcp.md index 0efe5b097..9a789c8d4 100644 --- a/docs/guide/messaging/transports/tcp.md +++ b/docs/guide/messaging/transports/tcp.md @@ -104,6 +104,9 @@ using var host = Host.CreateDefaultBuilder() rule.Message(); rule.Message(); + // Implementing a specific marker interface or common base class + rule.MessagesImplementing(); + // All types in a certain assembly rule.MessagesFromAssemblyContaining(); @@ -123,7 +126,7 @@ using var host = Host.CreateDefaultBuilder() opts.PublishAllMessages().ToPort(3333); }).StartAsync(); ``` -snippet source | anchor +snippet source | anchor diff --git a/src/Samples/DocumentationSamples/StaticPublishingRule.cs b/src/Samples/DocumentationSamples/StaticPublishingRule.cs index 00f3b1ca4..6c5728c5f 100644 --- a/src/Samples/DocumentationSamples/StaticPublishingRule.cs +++ b/src/Samples/DocumentationSamples/StaticPublishingRule.cs @@ -37,6 +37,9 @@ public static async Task StaticPublishingRules() rule.Message(); rule.Message(); + // Implementing a specific marker interface or common base class + rule.MessagesImplementing(); + // All types in a certain assembly rule.MessagesFromAssemblyContaining(); @@ -58,4 +61,8 @@ public static async Task StaticPublishingRules() #endregion } +} + +public interface IEventMarker +{ } \ No newline at end of file