Skip to content

Commit

Permalink
Add ability to switch off Request/Reply wolverine's queue declaration…
Browse files Browse the repository at this point in the history
… for RMQ transport.
  • Loading branch information
vitalie.glinca authored and jeremydmiller committed Nov 21, 2023
1 parent f28686a commit f59f000
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public RabbitMqTransport() : base(ProtocolName, "Rabbit MQ")

public LightweightCache<string, RabbitMqQueue> Queues { get; }

internal bool DeclareRequestReplySystemQueue { get; set; } = true;

public void Dispose()
{
try
Expand Down Expand Up @@ -183,19 +185,22 @@ protected override RabbitMqEndpoint findEndpointByUri(Uri uri)

protected override void tryBuildSystemEndpoints(IWolverineRuntime runtime)
{
var queueName = $"wolverine.response.{runtime.DurabilitySettings.AssignedNodeNumber}";

var queue = new RabbitMqQueue(queueName, this, EndpointRole.System)
if (DeclareRequestReplySystemQueue)
{
AutoDelete = true,
IsDurable = false,
IsListener = true,
IsUsedForReplies = true,
ListenerCount = 5,
EndpointName = ResponseEndpointName
};
var queueName = $"wolverine.response.{runtime.DurabilitySettings.AssignedNodeNumber}";

Queues[queueName] = queue;
var queue = new RabbitMqQueue(queueName, this, EndpointRole.System)
{
AutoDelete = true,
IsDurable = false,
IsListener = true,
IsUsedForReplies = true,
ListenerCount = 5,
EndpointName = ResponseEndpointName
};

Queues[queueName] = queue;
}

// Have to do this early to get everything together for the dead letter queues
foreach (var rabbitMqQueue in Queues)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ public RabbitMqTransportExpression DisableDeadLetterQueueing()
return this;
}

/// <summary>
/// Disable Wolverine's automatic Request/Reply queue declaration for a specific node
/// </summary>
/// <returns></returns>
public RabbitMqTransportExpression DisableSystemRequestReplyQueueDeclaration()
{
Transport.DeclareRequestReplySystemQueue = false;

return this;
}

public class BindingExpression
{
private readonly string _exchangeName;
Expand Down

0 comments on commit f59f000

Please sign in to comment.