You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled upon this diff , and wondered why it would map undefined to true - and not false.
Intuitively, I would assume that undefined would "evaluate" to false, and also by default the auto_delete attribute should be false, no?
To my understanding, Rabbit may decide to skip the default info (for whatever reason), and return auto_delete: undefined instead of auto_delete: false. But interpreting it as true makes no sense to me here.
And then: why only for auto_delete and not, for e.g. durable as well?
Thanks upfront!
I'll try to elaborate a bit / dig a little deeper. aka going down the rabbit-hole..
I can load definitions in the management UI from a JSON file:
So I can directly store auto_delete: undefined in the exchange configuration and get the same value back.
The management UI is displaying AD for "auto_delete": "undefined", - so the referenced diff is "correct" or at least it's consistent with the UI. (Which probably checks something like if (auto_delete), and it's true since it's a string "undefined".)
Exchanges are read from JSON and stored directly to DB, while Queues are validated upfront.
UPDATE: seems like new is not really explicit "validation", but it's just a nice coincidence that it works as a kind of verification here. AFAICS there is no real validation happening in the code. I also could not find any tests checking for valid entities being stored to the DB.
So the real question is: why does Rabbit ever return exchange.auto_delete: undefined it's wrong in my opinion. But please correct me if I'm wrong. I have never looked at this before.
The more I look at it, the more I think that the auto_delete: undefined == true is wrong. 🤷 I just don't know what impact the change to false would have. It may break some lib users somewhere.
Hi,
(@mkuratczyk in ref to the chat in Discord)
I stumbled upon this diff , and wondered why it would map
undefined
totrue
- and notfalse
.Intuitively, I would assume that
undefined
would "evaluate" tofalse
, and also by default theauto_delete
attribute should befalse
, no?To my understanding, Rabbit may decide to skip the default info (for whatever reason), and return
auto_delete: undefined
instead ofauto_delete: false
. But interpreting it astrue
makes no sense to me here.And then: why only for
auto_delete
and not, for e.g.durable
as well?Thanks upfront!
I'll try to elaborate a bit / dig a little deeper. aka going down the rabbit-hole..
I can load definitions in the management UI from a JSON file:
Note: you can't omit
durable
, because the import would fail:Also, you can't omit
auto_delete
in queues, because the import would fail:GET http://localhost:15672/api/exchanges
returns:And this is what it looks like in the UI:
So I can directly store
auto_delete: undefined
in the exchange configuration and get the same value back.The management UI is displaying
AD
for"auto_delete": "undefined",
- so the referenced diff is "correct" or at least it's consistent with the UI. (Which probably checks something likeif (auto_delete)
, and it'strue
since it's a string"undefined"
.)UPDATE: Yep:
and..
if ("hello") { console.log("yep") }
I had a look at the Rabbit code (I don't know Erlang):
But here I'm thinking that declaring an exchange with anything
undefined
should not be possible.add_queue in rabbit_definitions.erl tries to set defaults, here
maps:get(auto_delete, Queue, false)
.While add_exchange does not, but defaults to
undefined
. (add_queue looked the same once, until someone refactored)So my feeling is that there is a step missing for exchanges, some kind of validation:
Exchanges are read from JSON and stored directly to DB, while Queues are validated upfront.
UPDATE: seems like
new
is not really explicit "validation", but it's just a nice coincidence that it works as a kind of verification here. AFAICS there is no real validation happening in the code. I also could not find any tests checking for valid entities being stored to the DB.So the real question is: why does Rabbit ever return
exchange.auto_delete: undefined
it's wrong in my opinion. But please correct me if I'm wrong. I have never looked at this before.The more I look at it, the more I think that the
auto_delete: undefined == true
is wrong. 🤷 I just don't know what impact the change tofalse
would have. It may break some lib users somewhere.The text was updated successfully, but these errors were encountered: