rabbitmq-server/deps/rabbitmq_amqp_client
David Ansari 6eb1f87e14
Fix concurrent AMQP queue declarations (#13727)
* Fix concurrent AMQP queue declarations

Prior to this commit, when AMQP clients declared the same queues
concurrently, the following crash occurred:
```
  │ *Error{Condition: amqp:internal-error, Description: {badmatch,{<<"200">>,
  │            {map,[{{utf8,<<"leader">>},{utf8,<<"rabbit-2@carrot">>}},
  │                  {{utf8,<<"message_count">>},{ulong,0}},
  │                  {{utf8,<<"consumer_count">>},{uint,0}},
  │                  {{utf8,<<"name">>},{utf8,<<"cq-145">>}},
  │                  {{utf8,<<"vhost">>},{utf8,<<"/">>}},
  │                  {{utf8,<<"durable">>},{boolean,true}},
  │                  {{utf8,<<"auto_delete">>},{boolean,false}},
  │                  {{utf8,<<"exclusive">>},{boolean,false}},
  │                  {{utf8,<<"type">>},{utf8,<<"classic">>}},
  │                  {{utf8,<<"arguments">>},
  │                   {map,[{{utf8,<<"x-queue-type">>},{utf8,<<"classic">>}}]}},
  │                  {{utf8,<<"replicas">>},
  │                   {array,utf8,[{utf8,<<"rabbit-2@carrot">>}]}}]},
  │            {[{{resource,<<"/">>,queue,<<"cq-145">>},configure},
  │              {{resource,<<"/">>,queue,<<"cq-144">>},configure},
  │              {{resource,<<"/">>,queue,<<"cq-143">>},configure},
  │              {{resource,<<"/">>,queue,<<"cq-142">>},configure},
  │              {{resource,<<"/">>,queue,<<"cq-141">>},configure},
  │              {{resource,<<"/">>,queue,<<"cq-140">>},configure},
  │              {{resource,<<"/">>,queue,<<"cq-139">>},configure},
  │              {{resource,<<"/">>,queue,<<"cq-138">>},configure},
  │              {{resource,<<"/">>,queue,<<"cq-137">>},configure},
  │              {{resource,<<"/">>,queue,<<"cq-136">>},configure},
  │              {{resource,<<"/">>,queue,<<"cq-135">>},configure},
  │              {{resource,<<"/">>,queue,<<"cq-134">>},configure}],
  │             []}}}
  │ [{rabbit_amqp_management,handle_http_req,8,
  │                          [{file,"rabbit_amqp_management.erl"},{line,130}]},
  │  {rabbit_amqp_management,handle_request,5,
  │                          [{file,"rabbit_amqp_management.erl"},{line,43}]},
  │  {rabbit_amqp_session,incoming_mgmt_link_transfer,3,
  │                       [{file,"rabbit_amqp_session.erl"},{line,2317}]},
  │  {rabbit_amqp_session,handle_frame,2,
  │                       [{file,"rabbit_amqp_session.erl"},{line,963}]},
  │  {rabbit_amqp_session,handle_cast,2,
  │                       [{file,"rabbit_amqp_session.erl"},{line,539}]},
  │  {gen_server,try_handle_cast,3,[{file,"gen_server.erl"},{line,2371}]},
  │  {gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,2433}]},
  │  {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,329}]}], Info: map[]}
```

To repro, run the following command in parallel in two separate terminals:
```
./omq amqp -x 10000 -t /queues/cq-%d -y 0 -C 0 --queues classic  classic
```

* Simplify
2025-04-11 12:04:00 +02:00
..
include Enable AMQP 1.0 clients to manage topologies 2024-03-28 11:36:56 +01:00
src Bump timeout in RabbitMQ AMQP 1.0 Erlang client 2025-03-27 10:48:49 +01:00
test Fix concurrent AMQP queue declarations (#13727) 2025-04-11 12:04:00 +02:00
LICENSE Enable AMQP 1.0 clients to manage topologies 2024-03-28 11:36:56 +01:00
LICENSE-MPL-RabbitMQ Enable AMQP 1.0 clients to manage topologies 2024-03-28 11:36:56 +01:00
Makefile make: Fix regressions following make plugins cleanup 2024-09-10 15:42:28 +02:00
README.md Enable AMQP 1.0 clients to manage topologies 2024-03-28 11:36:56 +01:00
erlang.mk Enable AMQP 1.0 clients to manage topologies 2024-03-28 11:36:56 +01:00
rabbitmq-components.mk Enable AMQP 1.0 clients to manage topologies 2024-03-28 11:36:56 +01:00

README.md

Erlang RabbitMQ AMQP 1.0 Client

The Erlang AMQP 1.0 client is a client that can communicate with any AMQP 1.0 broker. In contrast, this project (Erlang RabbitMQ AMQP 1.0 Client) can only communicate with RabbitMQ. This project wraps (i.e. depends on) the Erlang AMQP 1.0 client providing additionally the following RabbitMQ management operations:

  • declare queue
  • get queue
  • delete queue
  • purge queue
  • bind queue to exchange
  • unbind queue from exchange
  • declare exchange
  • delete exchange
  • bind exchange to exchange
  • unbind exchange from exchange

Except for get queue, these management operations are defined in the AMQP 0.9.1 protocol. To support these AMQP 0.9.1 / RabbitMQ specific operations over AMQP 1.0, this project implements a subset of the following (most recent) AMQP 1.0 extension specifications:

This project might support more (non AMQP 0.9.1) RabbitMQ operations via AMQP 1.0 in the future.

Topologies (exchanges, bindings, queues) in RabbitMQ can be created via