Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalie.glinca authored and jeremydmiller committed Nov 21, 2023
1 parent 2a1cf42 commit d26520c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/guide/messaging/transports/rabbitmq/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ return await Host.CreateDefaultBuilder(args)
See the [Rabbit MQ .NET Client documentation](https://www.rabbitmq.com/dotnet-api-guide.html#connecting) for more information about configuring the `ConnectionFactory` to connect to Rabbit MQ.


## Disable Rabbit MQ Reply Queues

By default, Wolverine creates an in memory queue in the Rabbit MQ broker for each individual node that is used by Wolverine
for request/reply invocations (`IMessageBus.InvokeAsync<T>()` when used remotely). Great, but if your process does not
have permissions with your Rabbit MQ broker to create queues, you may encounter errors. Not to worry, you can disable
that Wolverine system queue creation with:

snippet: sample_disable_rabbit_mq_system_queue

Of course, doing so means that you will not be able to do request/reply through Rabbit MQ with your Wolverine application.


30 changes: 30 additions & 0 deletions src/Transports/RabbitMQ/Wolverine.RabbitMQ.Tests/Samples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,36 @@ public static async Task listen_to_topics()
#endregion
}

public static async Task disable_system_queue()
{
#region sample_disable_rabbit_mq_system_queue

using var host = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
// *A* way to configure Rabbit MQ using their Uri schema
// documented here: https://www.rabbitmq.com/uri-spec.html
opts.UseRabbitMq(new Uri("amqp://localhost"))

// Stop Wolverine from trying to create a reply queue
// for this node if your process does not have permission to
// do so against your Rabbit MQ broker
.DisableSystemRequestReplyQueueDeclaration();



// Set up a listener for a queue, but also
// fine-tune the queue characteristics if Wolverine
// will be governing the queue setup
opts.ListenToRabbitQueue("incoming2", q =>
{
q.PurgeOnStartup = true;
q.TimeToLive(5.Minutes());
});
}).StartAsync();

#endregion
}

public static async Task listen_to_queue()
{
Expand Down

0 comments on commit d26520c

Please sign in to comment.