Skip to content

Expose ConnectionFactory.DispatchConsumersAsync as a ReadOnly property on IConnection #1610

@luizcarlosfaria

Description

@luizcarlosfaria

Is your feature request related to a problem? Please describe.

Assuming that the user code create a Connectionfactory instance, directly or using .NET Aspire, my code (library) need to check (to verify during worker startup) when user use DispatchConsumersAsync = false, but try to use a asynchronous consumer.

Describe the solution you'd like

RabbitMQ.Client.ConnectionConfig is created with a DispatchConsumersAsync boolean property copy during ConnectionFactory.CreateConnectionAsync() call.

ConnectionConfig is forward to both, AutorecoveringConnection or Connection, constructors.

But today IConnection does not have a property to expose this.

Possible Solution

On RabbitMQ.Client.IConnection Interface

bool DispatchConsumersAsync { get; }

On RabbitMQ.Client.Framing.Impl.AutorecoveringConnection Class

bool DispatchConsumersAsync => this._config.DispatchConsumersAsync;

On RabbitMQ.Client.Framing.Impl.Connection Class

bool DispatchConsumersAsync => this._config.DispatchConsumersAsync;

Describe alternatives you've considered

Throw an exception itself when call Channel.BasicConsume() method with a synchronous consumer when ConnectionFactory is set to work with asynchronous dispatch. And vice-versa.

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions