1717 monitored = #{} :: #{pid () => ok }
1818 }).
1919
20+ -define (STATIC_KEYS , [name ,
21+ durable ,
22+ auto_delete ,
23+ arguments ,
24+ pid ,
25+ owner_pid ,
26+ exclusive ,
27+ policy ,
28+ operator_policy ,
29+ effective_policy_definition ,
30+ type ]).
2031
2132-opaque state () :: #? STATE {}.
2233
@@ -417,6 +428,16 @@ state_info(_State) ->
417428-spec info (amqqueue :amqqueue (), all_keys | rabbit_types :info_keys ()) ->
418429 rabbit_types :infos ().
419430info (Q , Items ) ->
431+ AllStaticItems = is_list (Items ) andalso
432+ lists :all (fun (I ) -> lists :member (I , ? STATIC_KEYS ) end , Items ),
433+ case AllStaticItems of
434+ true ->
435+ static_info (Q , Items );
436+ false ->
437+ info_call (Q , Items )
438+ end .
439+
440+ info_call (Q , Items ) ->
420441 QPid = amqqueue :get_pid (Q ),
421442 Req = case Items of
422443 all_keys -> info ;
@@ -432,6 +453,44 @@ info(Q, Items) ->
432453 Result
433454 end .
434455
456+ static_info (Q , Items ) ->
457+ [{I , i (I , Q )} || I <- Items ].
458+
459+ i (name , Q ) ->
460+ amqqueue :get_name (Q );
461+ i (durable , Q ) ->
462+ amqqueue :is_durable (Q );
463+ i (auto_delete , Q ) ->
464+ amqqueue :is_auto_delete (Q );
465+ i (arguments , Q ) ->
466+ amqqueue :get_arguments (Q );
467+ i (pid , Q ) ->
468+ amqqueue :get_pid (Q );
469+ i (owner_pid , Q ) when ? amqqueue_exclusive_owner_is (Q , none ) ->
470+ '' ;
471+ i (owner_pid , Q ) ->
472+ amqqueue :get_exclusive_owner (Q );
473+ i (exclusive , Q ) ->
474+ ExclusiveOwner = amqqueue :get_exclusive_owner (Q ),
475+ is_pid (ExclusiveOwner );
476+ i (policy , Q ) ->
477+ case rabbit_policy :name (Q ) of
478+ none -> '' ;
479+ Policy -> Policy
480+ end ;
481+ i (operator_policy , Q ) ->
482+ case rabbit_policy :name_op (Q ) of
483+ none -> '' ;
484+ Policy -> Policy
485+ end ;
486+ i (effective_policy_definition , Q ) ->
487+ case rabbit_policy :effective_definition (Q ) of
488+ undefined -> [];
489+ Def -> Def
490+ end ;
491+ i (type , _ ) ->
492+ classic .
493+
435494-spec purge (amqqueue :amqqueue ()) ->
436495 {ok , non_neg_integer ()}.
437496purge (Q ) when ? is_amqqueue (Q ) ->
0 commit comments