@@ -417,9 +417,8 @@ apply_(#{index := Index,
417417 {State , {dequeue , empty }, Effects }
418418 end
419419 end ;
420- apply_ (#{index := _Idx } = Meta ,
421- # checkout {spec = Spec ,
422- consumer_id = ConsumerId }, State0 )
420+ apply_ (Meta , # checkout {spec = Spec ,
421+ consumer_id = ConsumerId }, State0 )
423422 when Spec == cancel orelse
424423 Spec == remove ->
425424 case consumer_key_from_id (ConsumerId , State0 ) of
@@ -463,18 +462,9 @@ apply_(#{index := Idx} = Meta,
463462 {Consumer , State1 } = update_consumer (Meta , ConsumerKey , ConsumerId ,
464463 ConsumerMeta , Spec , Priority , State0 ),
465464 {State2 , Effs } = activate_next_consumer (State1 , []),
466- # consumer {checked_out = Checked ,
467- credit = Credit ,
468- delivery_count = DeliveryCount ,
469- next_msg_id = NextMsgId } = Consumer ,
470-
471- % % reply with a consumer summary
472- Reply = {ok , #{next_msg_id => NextMsgId ,
473- credit => Credit ,
474- key => ConsumerKey ,
475- delivery_count => DeliveryCount ,
476- is_active => is_active (ConsumerKey , State2 ),
477- num_checked_out => map_size (Checked )}},
465+
466+ % % reply with a consumer infos
467+ Reply = {ok , consumer_info (ConsumerKey , Consumer , State2 )},
478468 checkout (Meta , State0 , State2 , [{monitor , process , Pid } | Effs ], Reply );
479469apply_ (#{index := Index }, # purge {},
480470 #? STATE {messages_total = Total } = State0 ) ->
@@ -686,7 +676,7 @@ snapshot_installed(_Meta, #?MODULE{cfg = #cfg{},
686676 % % to local consumers
687677 % % TODO: with some additional state (raft indexes assigned to consumer)
688678 % % we could reduce the number of resends but it is questionable if this
689- % % complexity is worth the effort. rabbit_fifo_index will de-duplicate
679+ % % complexity is worth the effort. rabbit_fifo_client will de-duplicate
690680 % % deliveries anyway
691681 SendAcc = maps :fold (
692682 fun (_ConsumerKey , # consumer {cfg = # consumer_cfg {tag = Tag ,
@@ -3435,3 +3425,16 @@ dlx_delivery_effects(CPid, Msgs0) ->
34353425 end , Log , RsnIds ),
34363426 [{send_msg , CPid , {dlx_event , self (), {dlx_delivery , Msgs }}, [cast ]}]
34373427 end }].
3428+
3429+ consumer_info (ConsumerKey ,
3430+ # consumer {checked_out = Checked ,
3431+ credit = Credit ,
3432+ delivery_count = DeliveryCount ,
3433+ next_msg_id = NextMsgId },
3434+ State ) ->
3435+ #{next_msg_id => NextMsgId ,
3436+ credit => Credit ,
3437+ key => ConsumerKey ,
3438+ delivery_count => DeliveryCount ,
3439+ is_active => is_active (ConsumerKey , State ),
3440+ num_checked_out => map_size (Checked )}.
0 commit comments