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

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

Closed
luizcarlosfaria opened this issue Jun 23, 2024 · 3 comments · Fixed by #1615
Closed
Assignees
Milestone

Comments

@luizcarlosfaria
Copy link
Contributor

luizcarlosfaria commented Jun 23, 2024

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

@lukebakken
Copy link
Contributor

Please note that using the wrong combination of DispatchConsumersAsync and a consumer class will throw an exception:

https://github.com/rabbitmq/rabbitmq-dotnet-client/blob/main/projects/RabbitMQ.Client/client/impl/ChannelBase.cs#L976-L982

@lukebakken lukebakken closed this as not planned Won't fix, can't repro, duplicate, stale Jun 25, 2024
@lukebakken lukebakken self-assigned this Jun 25, 2024
@lukebakken lukebakken added this to the 7.0.0 milestone Jun 27, 2024
@lukebakken lukebakken reopened this Jun 27, 2024
@lukebakken
Copy link
Contributor

See #1615

@lukebakken
Copy link
Contributor

Fixed by #1615

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants