-
Notifications
You must be signed in to change notification settings - Fork 140
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
Allow re-using default connection config (custom properties) #152
Comments
Great, thank you. I suggest merging properties with the defaults, with the user-provided keys overwriting the default keys' values. If a user-provided value is |
Thank you for reporting this, good catch! I'm happy to a solution in the lines of point 2. The function If somebody doesn't want to have those defaults, they can always |
Both of the above mean that for clients that have been using properties other than default, they will now how to verbosely opt-out of defaults. Having properties (other than special cases defined by RMQ, like Consider NewConnectionProperties. These have since their release been promising empty value I will provide a change to |
This is true. I would counter argue that IMO, constructors should set sane defaults, in addition to initialising the type. This missing bit in the constructor is arguably a bug. Users who want to opt-out from the defaults can initialise the properties like: p := amqp.Table{"connection_name": "my-connection"}
config := amqp.Config{Properties: p} This has been the pattern up to 1.5.0, where
Indeed, we should fix the documentation alongside with the code. |
When using
SetClientConnectionName
(to identify connections in RabbitMQ) it is impossible to use the built-in client properties of this library.As per examples:
This results in default properties being ignored in openTune.
In the end we get either
{"connection_name": "sample-consumer"}
or{"product": "AMQP 0.9.1 Client", "version": "1.5.0", "platform": "golang"}
. Never both. Unless copied to client code with the risk of being outdated.Of course, clients providing their own properties might not want to have these present. Because of that it would not make sense to "provide defaults if not present" in the properties table.
However some kind of union between default properties and client provided metadata would be beneficial.
Possible solutions:
amqp.DefaultConfig()
that hasHeartbeat
,Locale
andProperties
set.With this,
amqp.Dial(url)
would be equal toamqp.DialConfig(url, amqp.DefaultConfig())
and setting other properties would go as follows:amqp.DefaultConfigProperties()
Names TBD.
I'm up to create a Pull Request with changes, but let's discuss what are your expectations first.
The text was updated successfully, but these errors were encountered: