Auto recover on access-refused

117 views
Skip to first unread message

travis...@gmail.com

unread,
Oct 23, 2018, 6:28:40 PM10/23/18
to rabbitmq-users
I currently am having some issues tying into the connection auto-recover process. Currently I have a client that connects to Rabbit, on the server side the user for Rabbit gets removed while I have a consumer(s) connected. When this occurs, my java client is supposed to re-register with the server but I'm having a heck of a time figuring out how to trap the AuthenticationFailureException.

2018-10-23 15:26:45.322 [AMQP Connection 192.168.120.60:5671] ERROR ForgivingExceptionHandler.log - Caught an exception during connection recovery!
com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism EXTERNAL. For details see the broker logfile.
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:351)
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:64)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConnection(AutorecoveringConnection.java:550)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.beginAutomaticRecovery(AutorecoveringConnection.java:512)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.access$000(AutorecoveringConnection.java:53)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection$2.recoveryCanBegin(AutorecoveringConnection.java:453)
at com.rabbitmq.client.impl.AMQConnection.notifyRecoveryCanBeginListeners(AMQConnection.java:702)
at com.rabbitmq.client.impl.AMQConnection.doFinalShutdown(AMQConnection.java:696)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:586)

Arnaud Cogoluègnes

unread,
Oct 24, 2018, 3:27:05 AM10/24/18
to rabbitm...@googlegroups.com
What would you like to do? Retry? Wait?

Currently there's no hook or exception handler inside the connection
recovery process. I'd suggest to use RecoveryListener: attempt to
connect until the user has come back on the broker and let the
recovery process move on once a connection attempt in the listener has
succeeded.

There's also ConnectionFactory#setCredentialsProvider if you need to
plug any logic in login / password retrieval.
> --
> You received this message because you are subscribed to the Google Groups
> "rabbitmq-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rabbitmq-user...@googlegroups.com.
> To post to this group, send email to rabbitm...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Travis Beech

unread,
Oct 24, 2018, 11:21:10 AM10/24/18
to rabbitm...@googlegroups.com
That's what I suspected, thank you for your reply Arnaud. Unfortunately for my this process, the hope was to remove the user server side, which would allow the client to detect client side that it needed to reregister with the server on a different topic using different credentials at which point a the original user would be put back onto the broker. It's a bit of a convoluted process unfortunately at this point because we are migrating a product from one communication stack (Windows NET TCP) to Rabbit but still need to maintain backwards compatibility for the next release. 

To post to this group, send an email to rabbitm...@googlegroups.com.

Arnaud Cogoluègnes

unread,
Oct 25, 2018, 9:18:09 AM10/25/18
to rabbitm...@googlegroups.com
RecoveryListener has a callback before connection recovery starts, so
my suggestion about trying to connect with the new credentials until
it succeeds and then let automatic recovery process start should do
the trick. You'll also need to use a custom CredentialsProvider so
that the new credentials are used during connection recovery. A
convoluted workaround for a convoluted process :-)
Reply all
Reply to author
Forward
0 new messages