-
Notifications
You must be signed in to change notification settings - Fork 75
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
Avoid static list of Addresses in ConnectionHandler #17
Comments
So basically you just want to change a Connection's options after it's been created? Right now the ConnectionOptions class is cloned when a Connection is created, and the new clone is stored internally for the Connection. If addresses are something that can change over time (like configuration) I'd consider either moving them to the ConnectionConfig interface where they can be exposed and modified over time or making the ConnectionOptions publicly available via the ConfigurableConnection interface. Conceptually, options were intended to be things that do not change whereas configuration can change. You've brought up a good point that for connections which can re-established, the config could potentially change. Do you have any API suggestions for what this would look like? |
Thanks for explaining the design considerations of ConnectionOptions and ConnectionConfig. I now understand the separation of concerns. Proposals for address resolver
Option 2 - A stateful resolver - helps to pick an address that has lesser number of open connections, or is located in the same zone/region. The entire logic can be plugged in this way.
Option 2 would be my preference since it caters to more usecases. Proposals for setting the address resolver |
… attempt for a connection. This is towards issue jhalterman#17 (jhalterman#17)
Please review and comment on the proposed changes as in the above comment. |
Have raised a pull request for this with Option 2. See #21. |
Still thinking about this feature. You described a few possible use cases for an AddressResolver, but I'm wondering how you'll most likely use this in practice? I'm just wondering about the necessity of having something like an AddressResolver versus simply being able to change the set of addresses ( |
In an environment that I'm working on right now, I would implement the AddressResolver to fetch the current list of addresses from a central registry. This is a http call to an external system which maintains the rabbitmq cluster member details and it would take a few milli-seconds to complete. Having to set "options.setAddresses" is ok, but the point is that I would need to update the addresses periodically anticipating a connection re-establishment. Having a resolver helps to optimize in saying that the fetch is going to be made only when required (i.e. when a new connection is being re-attempted). I haven't come across use-cases for updating the connection factory settings or the execution service after connection establishment. But if I do, I'll raise them here. |
Setup:
Problem:
The size of the rabbitmq cluster can scale up and down. But once a connection has been setup, the list of addresses cannot be updated without a restart or by discarding the connection and re-establishing the entire connection again.
Proposal:
Provide a dereferencing mechanism to obtain the list of Addresses by invoking a callback instead of maintaining a static list of Addresses.
Doing so solves the following use-cases:
Let me know your thoughts and I am willing to contribute in any way on this.
The text was updated successfully, but these errors were encountered: