Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Vitepress & Add 3.0 RabbitMq doco #1034

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {bundledLanguages} from 'shiki';
import { withMermaid } from "vitepress-plugin-mermaid"
import { DefaultTheme, UserConfig } from 'vitepress'

export default withMermaid( {
const config: UserConfig<DefaultTheme.Config> = {
base: '/',
lang: 'en-US',
title: 'Wolverine',
Expand Down Expand Up @@ -58,7 +58,7 @@ export default withMermaid( {
'/': [
{
text: 'Tutorials',
collapsible: true,
collapsed: true,
items: [
{text: 'Getting Started', link: '/tutorials/getting-started'},
{text: 'Wolverine as Mediator', link: '/tutorials/mediator'},
Expand All @@ -70,7 +70,6 @@ export default withMermaid( {
},
{
text: 'General',
collapsible: true,
collapsed: true,
items: [
{text: 'Basic Concepts', link: '/guide/basics'},
Expand All @@ -87,7 +86,6 @@ export default withMermaid( {
},
{
text: 'Messages and Handlers',
collapsible: true,
collapsed: true,
items: [
{text: 'Messages and Serialization', link: '/guide/messages'},
Expand All @@ -110,7 +108,6 @@ export default withMermaid( {
},
{
text: 'Messaging',
collapsible: true,
collapsed: true,
items: [
{text: 'Introduction to Messaging', link: '/guide/messaging/introduction'},
Expand All @@ -119,7 +116,6 @@ export default withMermaid( {
{text: 'Listening Endpoints', link: '/guide/messaging/listeners'},
{
text: 'Transports',
collapsible: true,
collapsed: true,
items: [
{text: 'Local Queues', link: '/guide/messaging/transports/local'},
Expand Down Expand Up @@ -167,7 +163,6 @@ export default withMermaid( {
},
{
text: 'ASP.Net Core Integration',
collapsible: true,
collapsed: true,
items: [
{text: 'Http Services with Wolverine', link: '/guide/http/'},
Expand All @@ -193,13 +188,12 @@ export default withMermaid( {
},
{
text: 'Durability and Persistence',
collapsible: true,
collapsed: true,
items: [
{text: 'Durable Inbox and Outbox Messaging', link: '/guide/durability/'},
{text: 'Troubleshooting and Leadership Election', link: '/guide/durability/leadership-and-troubleshooting'},
{text: 'Sagas', link: '/guide/durability/sagas'},
{text: 'Marten Integration', link: '/guide/durability/marten/', collapsible: true, collapsed: false, items: [
{text: 'Marten Integration', link: '/guide/durability/marten/', collapsed: false, items: [
{text: 'Transactional Middleware', link: '/guide/durability/marten/transactional-middleware'},
{text: 'Transactional Outbox Support', link: '/guide/durability/marten/outbox'},
{text: 'Transactional Inbox Support', link: '/guide/durability/marten/inbox'},
Expand Down Expand Up @@ -228,7 +222,9 @@ export default withMermaid( {
linkify: false
},
ignoreDeadLinks: true
});
}

export default withMermaid(config);



54 changes: 52 additions & 2 deletions docs/guide/messaging/transports/rabbitmq/conventional-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using var host = await Host.CreateDefaultBuilder()
.UseConventionalRouting();
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L293-L303' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_activating_rabbit_mq_conventional_routing' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L295-L305' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_activating_rabbit_mq_conventional_routing' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

With the defaults from above, for each message that the application can handle
Expand Down Expand Up @@ -73,8 +73,58 @@ using var host = await Host.CreateDefaultBuilder()
});
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L308-L342' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_activating_rabbit_mq_conventional_routing_customized' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L310-L344' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_activating_rabbit_mq_conventional_routing_customized' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

## Adjusting Routing Conventions

If the exchange/queue routing defaults don't suit your message routing requirements, they can be overridden as below.
This keeps existing naming conventions intact and avoids the need to drop down to manual exchange/queue definitions.

<!-- snippet: sample_conventional_routing_exchange_conventions -->
<a id='snippet-sample_conventional_routing_exchange_conventions'></a>
```cs
var sender = WolverineHost.For(opts =>
{
opts.UseRabbitMq()
.UseConventionalRouting(conventions =>
{
conventions.ExchangeNameForSending(type => type.Name + "_custom");
conventions.ConfigureSending((x, c) =>
{
// Route messages via headers exchange whilst taking advantage of conventional naming
if (c.MessageType == typeof(HeadersMessage))
{
x.ExchangeType(ExchangeType.Headers);
}
});
});
});

var receiver = WolverineHost.For(opts =>
{
opts.UseRabbitMq()
.UseConventionalRouting(conventions =>
{
conventions.ExchangeNameForSending(type => type.Name + "_custom");
conventions.ConfigureListeners((x, c) =>
{
if (c.MessageType == typeof(HeadersMessage))
{
// Bind our queue based on the headers tenant-id
x.BindToExchange<HeadersMessage>(ExchangeType.Headers,
arguments: new Dictionary<string, object>()
{
{ "tenant-id", "tenant-id" }
});
}
});
});
});
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L503-L541' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_conventional_routing_exchange_conventions' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->



TODO -- add content on filtering message types
6 changes: 3 additions & 3 deletions docs/guide/messaging/transports/rabbitmq/deadletterqueues.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using var host = await Host.CreateDefaultBuilder()
.DeadLetterQueueing(new DeadLetterQueue("incoming-errors"));
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L347-L365' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_overriding_rabbit_mq_dead_letter_queue' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L349-L367' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_overriding_rabbit_mq_dead_letter_queue' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

::: warning
Expand Down Expand Up @@ -66,7 +66,7 @@ using var host = await Host.CreateDefaultBuilder()
.DeadLetterQueueing(new DeadLetterQueue("incoming-errors", DeadLetterQueueMode.InteropFriendly));
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L370-L393' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_overriding_rabbit_mq_dead_letter_queue_interop_friendly' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L372-L395' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_overriding_rabbit_mq_dead_letter_queue_interop_friendly' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

And lastly, if you don't particularly want to have any Rabbit MQ dead letter queues and you quite like the [database backed
Expand All @@ -93,7 +93,7 @@ using var host = await Host.CreateDefaultBuilder()
opts.ListenToRabbitQueue("incoming").DisableDeadLetterQueueing();
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L398-L419' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_disable_rabbit_mq_dead_letter_queue' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L400-L421' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_disable_rabbit_mq_dead_letter_queue' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
8 changes: 4 additions & 4 deletions docs/guide/messaging/transports/rabbitmq/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ using var host = await Host.CreateDefaultBuilder()
});
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L97-L120' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_only_use_listener_connection_with_rabbitmq' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L99-L122' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_only_use_listener_connection_with_rabbitmq' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

To only send Rabbit MQ messages, but never receive them:
Expand Down Expand Up @@ -108,7 +108,7 @@ using var host = await Host.CreateDefaultBuilder()
});
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L125-L148' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_only_use_sending_connection_with_rabbitmq' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L127-L150' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_only_use_sending_connection_with_rabbitmq' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -134,7 +134,7 @@ using var host = await Host.CreateDefaultBuilder()
.EnableWolverineControlQueues();
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L79-L92' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_using_rabbit_mq_control_queues' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L81-L94' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_using_rabbit_mq_control_queues' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down Expand Up @@ -170,7 +170,7 @@ using var host = await Host.CreateDefaultBuilder()
});
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L50-L74' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_disable_rabbit_mq_system_queue' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L52-L76' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_disable_rabbit_mq_system_queue' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Of course, doing so means that you will not be able to do request/reply through Rabbit MQ with your Wolverine application.
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/messaging/transports/rabbitmq/interoperability.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ builder.UseWolverine(opts =>
using var host = builder.Build();
await host.StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L424-L443' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_setting_default_message_type_with_rabbit' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L426-L445' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_setting_default_message_type_with_rabbit' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

With this setting, there is **no other required headers** for Wolverine to process incoming messages. However, Wolverine will be
Expand Down Expand Up @@ -135,7 +135,7 @@ builder.UseWolverine(opts =>
using var host = builder.Build();
await host.StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L448-L471' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_registering_custom_rabbit_mq_envelope_mapper' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L450-L473' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_registering_custom_rabbit_mq_envelope_mapper' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
4 changes: 2 additions & 2 deletions docs/guide/messaging/transports/rabbitmq/listening.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ using var host = await Host.CreateDefaultBuilder()
});
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L153-L184' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_listening_to_rabbitmq_queue' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L155-L186' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_listening_to_rabbitmq_queue' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

To optimize and tune the message processing, you may want to read more about the [Rabbit MQ prefetch count and prefetch
Expand Down Expand Up @@ -80,5 +80,5 @@ using var host = await Host.CreateDefaultBuilder()
});
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L153-L184' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_listening_to_rabbitmq_queue' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L155-L186' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_listening_to_rabbitmq_queue' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ builder.UseWolverine(opts =>
opts.PublishAllMessages().ToRabbitTopicsOnNamedBroker(external, "topics");
});
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L532-L566' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_configure_additional_rabbit_mq_broker' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L578-L612' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_configure_additional_rabbit_mq_broker' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

The `Uri` values for endpoints to the additional broker follows the same rules as the normal usage of the Rabbit MQ
Expand Down
8 changes: 4 additions & 4 deletions docs/guide/messaging/transports/rabbitmq/object-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using var host = await Host.CreateDefaultBuilder()
opts.PublishAllMessages().ToRabbitExchange("exchange1");
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L239-L259' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_publish_to_rabbitmq_routing_key' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L241-L261' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_publish_to_rabbitmq_routing_key' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

At development time -- or occasionally in production systems -- you may want to have the messaging
Expand All @@ -47,7 +47,7 @@ using var host = await Host.CreateDefaultBuilder()
.AutoPurgeOnStartup();
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L264-L273' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_autopurge_rabbitmq' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L266-L275' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_autopurge_rabbitmq' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or you can be more selective and only have certain queues of volatile messages purged
Expand All @@ -64,7 +64,7 @@ using var host = await Host.CreateDefaultBuilder()
.DeclareQueue("queue2", q => q.PurgeOnStartup = true);
}).StartAsync();
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L278-L288' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_autopurge_selective_queues' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L280-L290' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_autopurge_selective_queues' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Wolverine's Rabbit MQ integration also supports the [Oakton stateful resource](https://jasperfx.github.io/oakton/guide/host/resources.html) model,
Expand Down Expand Up @@ -186,6 +186,6 @@ public class MyModuleExtension : IWolverineExtension
}
}
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L499-L514' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_rabbitmq_configuration_in_wolverine_extension' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs#L545-L560' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_rabbitmq_configuration_in_wolverine_extension' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Loading
Loading