Closed agross closed 7 months ago
Nevermind, the exception is sufficiently clear and suggests that the second connection fails due to an exception in TimerBasedCredentialRefresher
.
@agross thank you for this detailed report. I'll get right on it.
@agross I've got the following PR that will address the issue in main
- https://github.com/rabbitmq/rabbitmq-dotnet-client/pull/1431
Back-porting to 6.x
now, then I will create a pre-release for you to test.
@agross I just released version 6.8.0-rc.1
, would you mind testing it out?
Re-opening until I hear back from @agross
After upgrading RabbitMQ.Client to 6.8.0-rc.1 my sample works without issues. Many thanks! 👍
@agross thank you for confirming the fix 💪
Describe the bug
I'm currently trying to get OAuth working against Keycloak. So far auth works, but as soon as I enable
CredentialsRefresher
according to the docs I can only open a single connection from theConnectionFactory
. The issue is that the messaging lib I want to use (Wolverine) opens 2 connections to RabbitMQ by default.Reproduction steps
You probably need a working Keycloak instance prepared according to RabbitMQ's own example.
Exception:
Expected behavior
Second connection can be opened.
Additional context
I think the issue is that
TimerBasedCredentialRefresher.Register
is called for each connection being made. It tries to register the refresher perICredentialsProvider
(there is only one). At the time the second connection is made the first connection's provider is already registered for refreshing.