19
19
monitored = #{} :: #{pid () => ok }
20
20
}).
21
21
22
+ -define (STATIC_KEYS , [name ,
23
+ durable ,
24
+ auto_delete ,
25
+ arguments ,
26
+ pid ,
27
+ leader ,
28
+ members ,
29
+ owner_pid ,
30
+ exclusive ,
31
+ policy ,
32
+ operator_policy ,
33
+ effective_policy_definition ,
34
+ type ]).
22
35
23
36
-opaque state () :: #? STATE {}.
24
37
@@ -510,6 +523,16 @@ state_info(_State) ->
510
523
-spec info (amqqueue :amqqueue (), all_keys | rabbit_types :info_keys ()) ->
511
524
rabbit_types :infos ().
512
525
info (Q , Items ) ->
526
+ AllStaticItems = is_list (Items ) andalso
527
+ lists :all (fun (I ) -> lists :member (I , ? STATIC_KEYS ) end , Items ),
528
+ case AllStaticItems of
529
+ true ->
530
+ static_info (Q , Items );
531
+ false ->
532
+ info_call (Q , Items )
533
+ end .
534
+
535
+ info_call (Q , Items ) ->
513
536
QPid = amqqueue :get_pid (Q ),
514
537
Req = case Items of
515
538
all_keys -> info ;
@@ -525,6 +548,48 @@ info(Q, Items) ->
525
548
Result
526
549
end .
527
550
551
+ static_info (Q , Items ) ->
552
+ [{I , i (I , Q )} || I <- Items ].
553
+
554
+ i (name , Q ) ->
555
+ amqqueue :get_name (Q );
556
+ i (durable , Q ) ->
557
+ amqqueue :is_durable (Q );
558
+ i (auto_delete , Q ) ->
559
+ amqqueue :is_auto_delete (Q );
560
+ i (arguments , Q ) ->
561
+ amqqueue :get_arguments (Q );
562
+ i (pid , Q ) ->
563
+ amqqueue :get_pid (Q );
564
+ i (leader , Q ) ->
565
+ node (i (pid , Q ));
566
+ i (members , Q ) ->
567
+ [i (leader , Q )];
568
+ i (owner_pid , Q ) when ? amqqueue_exclusive_owner_is (Q , none ) ->
569
+ '' ;
570
+ i (owner_pid , Q ) ->
571
+ amqqueue :get_exclusive_owner (Q );
572
+ i (exclusive , Q ) ->
573
+ ExclusiveOwner = amqqueue :get_exclusive_owner (Q ),
574
+ is_pid (ExclusiveOwner );
575
+ i (policy , Q ) ->
576
+ case rabbit_policy :name (Q ) of
577
+ none -> '' ;
578
+ Policy -> Policy
579
+ end ;
580
+ i (operator_policy , Q ) ->
581
+ case rabbit_policy :name_op (Q ) of
582
+ none -> '' ;
583
+ Policy -> Policy
584
+ end ;
585
+ i (effective_policy_definition , Q ) ->
586
+ case rabbit_policy :effective_definition (Q ) of
587
+ undefined -> [];
588
+ Def -> Def
589
+ end ;
590
+ i (type , _ ) ->
591
+ classic .
592
+
528
593
-spec purge (amqqueue :amqqueue ()) ->
529
594
{ok , non_neg_integer ()}.
530
595
purge (Q ) when ? is_amqqueue (Q ) ->
0 commit comments