Replies: 4 comments
-
@Ayanda-D that would be a potentially breaking change that will get angry exactly the audience you try to advocate for: users of statically typed languages. C++ does not consider I'm afraid this is a very common binary protocol problem that has no universally accepted solution. |
Beta Was this translation helpful? Give feedback.
-
@Ayanda-D I'm sorry but I don't buy the argument about the management UI. Any Web UI does not have much choice in what type it uses: 99.999% of Web apps use the most generic value possible because that's how JavaScript and JSON work. Not only the management UI can use a value different from C++, so can a Java app coded differently, so will Python, JS, Elixir, and any other dynamically typed language where numbers autopromote. RabbitMQ cannot and should not organize that chaos. Your apps must agree on the values they use. Sorry, this is not something realistic for a 17 year old tool with 20+ client libraries. |
Beta Was this translation helpful? Give feedback.
-
I would understand if RabbitMQ itself used inconsistent types for what it stores or declares internally. But to my knowledge, in the few places where it does declare a topology, the numerical types are always Adopting a rule that requires all C++ clients to use an equivalent of a |
Beta Was this translation helpful? Give feedback.
-
That's what we've seen as well, hence highlighting what the Management-Plugin also does - assigning & similarly in other clients like Java, e.g. whether a client specifies an "L" suffix or not, RabbitMQ should simply treat these same (decode to Map<String, Object> args = new HashMap<String, Object>();
args.put("x-test-arg", "any");
args.put("group", 123456);
channel.queueBind(QUEUE_NAME, EXCHANGE, ROUTING_KEY, args); Or, Map<String, Object> args = new HashMap<String, Object>();
args.put("x-test-arg", "any");
args.put("group", 123456L);
channel.queueBind(QUEUE_NAME, EXCHANGE, ROUTING_KEY, args); We feel RabbitMQ should be translating/handling numeric types just as its underlying implementation language, Erlang, does - to a generic number type (which can be referred to as a |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
We've noticed that client applications specifying numeric arguments packed in different bit-lengths results in the broker encoding to different internal representation types, which can cause what may appear like duplicate AMQP elements from a user perspective, but internally just a different representation. For example using RMQ C++ client, the following code (note, the difference in
int32_t
andint64_t
arg types):Results in:
On tracing the command assembler when executing the snippet above, you can see the 2 consecutive
queue.bind
resulting in{<<"group">>,signedint,123456}
and{<<"group">>,long,123456}
:Reproduction steps
NOTE: You can also easily reproduce this by creating 2 bindings, one from with Pika and the other with Elixir Client (which abstract types):
Pika
Elixir
Should give the same what appears a duplicate binding as above.
Expected behavior
We expect RabbitMQ to use same internal type for the numeric arg e.g.
long
for both, regardless the client and the bit-length packing, OR to support both types and not result in things that appear like duplicate bindings to the user/client apps. Seems like a change that touch the protocol aspects which can potentially affect a couple of things - hence leaving this for you folks to fix (we also dont have the time).Also note, the Management-Plugin assigns type
long
for numeric arguments on e.g. bindings created on the UI, which it sets here (there's nosignedint
):https://github.com/rabbitmq/rabbitmq-server/blob/v3.12.13/deps/rabbit_common/src/rabbit_misc.erl#L388
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions