Skip to content
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

Ability to reload Gateway options when running embedded #6321

Open
Nintron27 opened this issue Jan 5, 2025 · 0 comments
Open

Ability to reload Gateway options when running embedded #6321

Nintron27 opened this issue Jan 5, 2025 · 0 comments
Labels
proposal Enhancement idea or proposal

Comments

@Nintron27
Copy link

Proposed change

The ability to reload the gateway options (server.Options.gateway) when running the nats-server embedded.

Currently if you clone the Options, modify the settings in Gateway and then call server.ReloadOptions(opts) you are returned an error such as: config reload not supported for Gateway: <GATEWAY STRUCTS HERE>.

Use case

This could be useful for projects where new gateways can be created or removed dynamically, and you don't want nodes to continuously try reconnecting to a gateway that no longer exists, and won't exist.

For example:

  1. Cluster A is created and is listening for gateway connections.
  2. Cluster B is created, listening for gateway connections, and is configured to connect to cluster A via a gateway.
  3. Then, cluster A is spun down and removed. All nodes in cluster B will continuously, as configured, try to reconnect to cluster A until they are restarted with a new configuration that doesn't have that gateway.

For my specific use case, I am trying to create a library that adds platform functionality to embedding NATS into Go projects. So for example if you deploy on Fly.io the library will automatically cluster nodes in the same region, and super cluster every region an app is deployed in. But, if in the example you remove "cluster A" (a specific region), the nodes in cluster B will try to connect ad infinitum.

Contribution

No response

@Nintron27 Nintron27 added the proposal Enhancement idea or proposal label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Enhancement idea or proposal
Projects
None yet
Development

No branches or pull requests

1 participant