9
9
% % The Original Code is RabbitMQ.
10
10
% %
11
11
% % The Initial Developer of the Original Code is Pivotal Software, Inc.
12
+ <<<<<<< HEAD
12
13
% % Copyright (c) 2007-2025 Broadcom. All Rights Reserved.
14
+ =======
15
+ % % Copyright (c) 2020-2025 Broadcom. All Rights Reserved.
16
+ >>>>>>> 69 d0382dd (Emit cancellation event only when stream consumer is cancelled )
13
17
% % The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
14
18
% %
15
19
@@ -2249,7 +2253,7 @@ handle_frame_post_auth(Transport,
2249
2253
{Connection , State };
2250
2254
true ->
2251
2255
{Connection1 , State1 } =
2252
- remove_subscription (SubscriptionId , Connection , State ),
2256
+ remove_subscription (SubscriptionId , Connection , State , true ),
2253
2257
response_ok (Transport , Connection , unsubscribe , CorrelationId ),
2254
2258
{Connection1 , State1 }
2255
2259
end ;
@@ -3081,7 +3085,7 @@ evaluate_state_after_secret_update(Transport,
3081
3085
_ ->
3082
3086
{C1 , S1 } =
3083
3087
lists :foldl (fun (SubId , {Conn , St }) ->
3084
- remove_subscription (SubId , Conn , St )
3088
+ remove_subscription (SubId , Conn , St , false )
3085
3089
end , {C0 , S0 }, Subs ),
3086
3090
{Acc #{Str => ok }, C1 , S1 }
3087
3091
end
@@ -3216,7 +3220,8 @@ notify_connection_closed(#statem_data{connection =
3216
3220
ConnectionState }) ->
3217
3221
rabbit_core_metrics :connection_closed (self ()),
3218
3222
[rabbit_stream_metrics :consumer_cancelled (self (),
3219
- stream_r (S , Connection ), SubId )
3223
+ stream_r (S , Connection ),
3224
+ SubId , false )
3220
3225
|| # consumer {configuration =
3221
3226
# consumer_configuration {stream = S ,
3222
3227
subscription_id = SubId }}
@@ -3304,7 +3309,8 @@ clean_state_after_stream_deletion_or_failure(MemberPid, Stream,
3304
3309
rabbit_stream_metrics :consumer_cancelled (self (),
3305
3310
stream_r (Stream ,
3306
3311
C0 ),
3307
- SubId ),
3312
+ SubId ,
3313
+ false ),
3308
3314
maybe_unregister_consumer (
3309
3315
VirtualHost , Consumer ,
3310
3316
single_active_consumer (Consumer ),
@@ -3314,7 +3320,8 @@ clean_state_after_stream_deletion_or_failure(MemberPid, Stream,
3314
3320
rabbit_stream_metrics :consumer_cancelled (self (),
3315
3321
stream_r (Stream ,
3316
3322
C0 ),
3317
- SubId ),
3323
+ SubId ,
3324
+ false ),
3318
3325
maybe_unregister_consumer (
3319
3326
VirtualHost , Consumer ,
3320
3327
single_active_consumer (Consumer ),
@@ -3431,7 +3438,8 @@ remove_subscription(SubscriptionId,
3431
3438
stream_subscriptions =
3432
3439
StreamSubscriptions } =
3433
3440
Connection ,
3434
- # stream_connection_state {consumers = Consumers } = State ) ->
3441
+ # stream_connection_state {consumers = Consumers } = State ,
3442
+ Notify ) ->
3435
3443
#{SubscriptionId := Consumer } = Consumers ,
3436
3444
# consumer {log = Log ,
3437
3445
configuration = # consumer_configuration {stream = Stream , member_pid = MemberPid }} =
@@ -3457,7 +3465,8 @@ remove_subscription(SubscriptionId,
3457
3465
Connection2 = maybe_clean_connection_from_stream (MemberPid , Stream , Connection1 ),
3458
3466
rabbit_stream_metrics :consumer_cancelled (self (),
3459
3467
stream_r (Stream , Connection2 ),
3460
- SubscriptionId ),
3468
+ SubscriptionId ,
3469
+ Notify ),
3461
3470
3462
3471
Requests1 = maybe_unregister_consumer (
3463
3472
VirtualHost , Consumer ,
0 commit comments