Git Product home page Git Product logo

Comments (6)

jhalterman avatar jhalterman commented on August 22, 2024

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?

from lyra.

Srinathc avatar Srinathc commented on August 22, 2024

Thanks for explaining the design considerations of ConnectionOptions and ConnectionConfig. I now understand the separation of concerns.

Proposals for address resolver
Option 1 - A very simple one, and should suffice for most cases and good to start with

   // A resolver that is called back when a new (or recovery) connection is attempted       
   public interface AddressResolver {
        Address[] resolve();
   }

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.

   // A resolver that is called back when a new (or recovery) connection is attempted
   public interface AddressResolver {
        Address nextAddress();
   }

Option 2 would be my preference since it caters to more usecases.

Proposals for setting the address resolver
I would be ok to have the resolver set into either the Options or the Config.

from lyra.

Srinathc avatar Srinathc commented on August 22, 2024

Please review and comment on the proposed changes as in the above comment.

from lyra.

Srinathc avatar Srinathc commented on August 22, 2024

Have raised a pull request for this with Option 2. See #21.
Happy to incorporate any review comments suggested.

from lyra.

jhalterman avatar jhalterman commented on August 22, 2024

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 (options.setAddresses) after a Connection has been established. Along the same lines, it makes me wonder if there's a need to change other ConnectionOptions after a Connection has been established - probably not, but if so I'd like to address all of this at the same time.

from lyra.

Srinathc avatar Srinathc commented on August 22, 2024

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.

from lyra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.