Skip to content

Commit

Permalink
Add .MessagesImplementing<T>() to the docs about message routing
Browse files Browse the repository at this point in the history
  • Loading branch information
Xzelsius authored and jeremydmiller committed Oct 17, 2023
1 parent 35c9a80 commit 4f7e057
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/guide/messaging/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ using var host = Host.CreateDefaultBuilder()
rule.Message<PingMessage>();
rule.Message<Message1>();

// Implementing a specific marker interface or common base class
rule.MessagesImplementing<IEventMarker>();

// All types in a certain assembly
rule.MessagesFromAssemblyContaining<PingMessage>();

Expand All @@ -77,7 +80,7 @@ using var host = Host.CreateDefaultBuilder()
opts.PublishAllMessages().ToPort(3333);
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Samples/DocumentationSamples/StaticPublishingRule.cs#L13-L59' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_staticpublishingrules' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Samples/DocumentationSamples/StaticPublishingRule.cs#L13-L62' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_staticpublishingrules' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Do note that doing the message type filtering by namespace will also include child namespaces. In
Expand Down
5 changes: 4 additions & 1 deletion docs/guide/messaging/transports/tcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ using var host = Host.CreateDefaultBuilder()
rule.Message<PingMessage>();
rule.Message<Message1>();

// Implementing a specific marker interface or common base class
rule.MessagesImplementing<IEventMarker>();

// All types in a certain assembly
rule.MessagesFromAssemblyContaining<PingMessage>();

Expand All @@ -123,7 +126,7 @@ using var host = Host.CreateDefaultBuilder()
opts.PublishAllMessages().ToPort(3333);
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Samples/DocumentationSamples/StaticPublishingRule.cs#L13-L59' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_staticpublishingrules' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Samples/DocumentationSamples/StaticPublishingRule.cs#L13-L62' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_staticpublishingrules' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
7 changes: 7 additions & 0 deletions src/Samples/DocumentationSamples/StaticPublishingRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public static async Task StaticPublishingRules()
rule.Message<PingMessage>();
rule.Message<Message1>();

// Implementing a specific marker interface or common base class
rule.MessagesImplementing<IEventMarker>();

// All types in a certain assembly
rule.MessagesFromAssemblyContaining<PingMessage>();

Expand All @@ -58,4 +61,8 @@ public static async Task StaticPublishingRules()

#endregion
}
}

public interface IEventMarker
{
}

0 comments on commit 4f7e057

Please sign in to comment.