adding max channels per upstream connection as configurable item#227
adding max channels per upstream connection as configurable item#227
Conversation
spuun
left a comment
There was a problem hiding this comment.
I wonder if we should add support for query parameters in the upstream url instead of new configs? Like we do in amqp-client.cr? channel_max, heartbeat and such.
| Signal::TERM.trap &->self.initiate_shutdown(Signal) | ||
|
|
||
| server = @server = AMQProxy::Server.new(u.hostname || "", port, tls, @idle_connection_timeout) | ||
| server = @server = AMQProxy::Server.new(u.hostname || "", port, tls, @idle_connection_timeout, @max_upstream_channels) |
There was a problem hiding this comment.
What if it's @max_upstream_channels is set to 0? It should probably default to `UInt16::MAX in that case?
There was a problem hiding this comment.
yes setting that to 0 does indeed break amqproxy, and yes that sounds like how it "should" work.
If I read it right then we are doing both for edit; noticed it is not working, we are extracting query parameters in amqproxy/src/amqproxy/server.cr Line 20 in 0df86ca but we are only sending the value when creating here so we never fetch the value from the URL?: Line 120 in 0df86ca so instead we should pass the upstream URL and do the parsing in or.. we just take them in the AMQP_URL, pass them to Server.new, and remove the option to use config file for it :) |
spuun
left a comment
There was a problem hiding this comment.
If I read it right then we are doing both for
idle_connection_timeoutfor example, which is a bit similar? but also it's not really an amqp parameter so maybe it shouldn't be just the sameedit; noticed it is not working, we are extracting query parameters in
amqproxy/src/amqproxy/server.cr
Line 20 in 0df86ca
but we are only sending the value when creating here so we never fetch the value from the URL?:
Hm, yeah, the constructor accepting an uri is never used 🤷
We can go with this. If we want to refactor the code in the future it's not a problem, we could still support cli opt/env/config.
Making sure that 0 means UInt16::MAX should be fixed though.
fixes #225
discussion in slack: https://84codes.slack.com/archives/CGPFUGGS0/p1763573521414509
To be able to set a channel-max on upstream connections. If unset, will default on the brokers configuration, or default to UInt16::MAX if disabled on broker (similar to current behaviour).
Will negotiate the lowest value between what customer specifies and what the broker says to ensure we don't override broker settings.
Will ensure that there is a way to distribute amqproxy connections across if a multi-node cluster is used.