diff options
| -rw-r--r-- | docs/rabbitmqctl.1.xml | 5 | ||||
| -rw-r--r-- | src/rabbit_amqqueue_process.erl | 5 | ||||
| -rw-r--r-- | test/src/rabbit_tests.erl | 10 |
3 files changed, 17 insertions, 3 deletions
diff --git a/docs/rabbitmqctl.1.xml b/docs/rabbitmqctl.1.xml index 4a5e315ecd..74ef71108e 100644 --- a/docs/rabbitmqctl.1.xml +++ b/docs/rabbitmqctl.1.xml @@ -1230,6 +1230,11 @@ queue is non-exclusive.</para></listitem> </varlistentry> <varlistentry> + <term>exclusive</term> + <listitem><para>True if queue is exclusive (i.e. has + owner_pid), false otherwise</para></listitem> + </varlistentry> + <varlistentry> <term>exclusive_consumer_pid</term> <listitem><para>Id of the Erlang process representing the channel of the exclusive consumer subscribed to this queue. Empty if diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 15fde37c9c..452047fdb2 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -92,7 +92,8 @@ durable, auto_delete, arguments, - owner_pid + owner_pid, + exclusive ]). -define(INFO_KEYS, [pid | ?CREATION_EVENT_KEYS ++ ?STATISTICS_KEYS -- [name]]). @@ -828,6 +829,8 @@ i(owner_pid, #q{q = #amqqueue{exclusive_owner = none}}) -> ''; i(owner_pid, #q{q = #amqqueue{exclusive_owner = ExclusiveOwner}}) -> ExclusiveOwner; +i(exclusive, #q{q = #amqqueue{exclusive_owner = ExclusiveOwner}}) -> + is_pid(ExclusiveOwner); i(policy, #q{q = Q}) -> case rabbit_policy:name(Q) of none -> ''; diff --git a/test/src/rabbit_tests.erl b/test/src/rabbit_tests.erl index 2235717ebf..e7df47a3d8 100644 --- a/test/src/rabbit_tests.erl +++ b/test/src/rabbit_tests.erl @@ -1192,17 +1192,23 @@ test_queue_master_location_policy_validation() -> test_server_status() -> %% create a few things so there is some useful information to list {_Writer, Limiter, Ch} = test_channel(), - [Q, Q2] = [Queue || Name <- [<<"foo">>, <<"bar">>], + [Q, Q2] = [Queue || {Name, Owner} <- [{<<"foo">>, none}, {<<"bar">>, self()}], {new, Queue = #amqqueue{}} <- [rabbit_amqqueue:declare( rabbit_misc:r(<<"/">>, queue, Name), - false, false, [], none)]], + false, false, [], Owner)]], ok = rabbit_amqqueue:basic_consume( Q, true, Ch, Limiter, false, 0, <<"ctag">>, true, [], undefined), %% list queues ok = info_action(list_queues, rabbit_amqqueue:info_keys(), true), + %% as we have no way to collect output of info_action/3 call, the only way + %% we can test individual queueinfoitems is by directly calling + %% rabbit_amqqueue:info/2 + [{exclusive, false}] = rabbit_amqqueue:info(Q, [exclusive]), + [{exclusive, true}] = rabbit_amqqueue:info(Q2, [exclusive]), + %% list exchanges ok = info_action(list_exchanges, rabbit_exchange:info_keys(), true), |
