-
Notifications
You must be signed in to change notification settings - Fork 86
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
Need a way to create non-auto recovery RMQConnection #174
Comments
I have the same requirement; our use case is such that we are using access tokens as passwords that are proxied through an HTTP backend for authentication. Auto-recovery fails for us because the tokens could be expired at the point of retrying the connection. I have gotten around this though, by attaching a publisher (swift Combine) to our delegate class that can be subscribed to for disconnect events. From there we can manually tear the connection down and rebuild tokens as needed. Maybe this can help others: @objc class ConnectionDelegate: NSObject, RMQConnectionDelegate {
var disconnectCalled = PassthroughSubject<Bool,Never>()
...
func connection(_ connection: RMQConnection!, disconnectedWithError error: Error!) {
disconnectCalled.send(true)
}
...
}
let connection_delegate = ConnectionDelegate()
let disconnect_subscription = connection_delegate!.disconnectCalled.sink { [weak self] _ in
guard let self_ = self else { return }
// teardown, refresh tokens, reconnect, etc...
self_.doTearDownAndReconnect()
}
...
let connection = RMQConnection(
transport: transport,
config: config,
handshakeTimeout: 10,
channelAllocator: allocator!,
frameHandler: allocator!,
delegate: connection_delegate!,
command: commandQueue!,
waiterFactory: RMQSemaphoreWaiterFactory(),
heartbeatSender: heartbeatSender!)
connection?.start() |
Other clients have relevant features such as:
|
While disabling recovery would be one reasonable option, both features above can be just as relevant, in particular with modern RabbitMQ versions. |
@michaelklishin, means to inject updated secrets prior to reconnect attempts would be marvelous.. |
As title was told. I don't find any way to create a RMQ Connection without auto recovery.
I think it is necessary option when create a connection (like Java Library)
The text was updated successfully, but these errors were encountered: