Skip to content

Added option to maintain AddressResolver address order for AutoRecove… #690

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

Closed
wants to merge 1 commit into from

Conversation

ValSmith
Copy link

@ValSmith ValSmith commented Jun 18, 2021

Allows the option to maintain the address order from the address resolver when using an auto recoverable connection. The default behavior is unchanged. This pull request is for the issue #689

@ValSmith ValSmith force-pushed the addressResolverOrder branch from 19e0a23 to ae0b448 Compare June 18, 2021 20:30
@michaelklishin
Copy link
Contributor

Thank you for taking the time to put together a PR. As I explained in #689, this behavior is by design. Any client can connect to any node and "endpoint priority" is not a concept I feel we need since it doesn't actually exist in RabbitMQ and any client I can think of.

ConnectionFactory already has so many options that we would prefer to see a lot of demand for a feature before introducing it.

@michaelklishin
Copy link
Contributor

What we could potentially do is to move the shuffling to the currently available resolvers and let someone introduce their own that maintains a sequential order. I don't know how many people with custom resolves there are, though, and how many of them would prefer to avoid the reshuffling or care about it. But at least most users do not use custom resolvers.

@michaelklishin
Copy link
Contributor

I later thought of another option: we could introduce a base class that does reshuffling in a "post-resolution" step and base all existing implementations on it. Let me have a quick go at it.

@ValSmith
Copy link
Author

That could be a good idea. There could be a default implementation of AddressResolver that does the shuffling then the connection factories don't have to think about it at all. You could initialize with a static AddressResolver.build([addresses]). Our specific use case is that we have a rabbit cluster running in various availability zones in AWS and an application that is also spread out so we want each application node to connect to the closer rabbit node if possible.

michaelklishin added a commit that referenced this pull request Jun 20, 2021
so that it can be overridden by implementations, e.g. to perform
no shuffling at all.

References #690.
@michaelklishin
Copy link
Contributor

Yup, a default implementation in AddressResolver is what I ended up with, see #691.

acogoluegnes pushed a commit that referenced this pull request Jun 21, 2021
so that it can be overridden by implementations, e.g. to perform
no shuffling at all.

References #690.

(cherry picked from commit a4e76fb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants