@@ -24,24 +24,16 @@ use up_rust::{
2424 UAttributes ,
2525} ;
2626
27- use crate :: {
28- helpers, usubscription,
29- { notification_manager:: NotificationEvent , subscription_manager:: SubscriptionEvent } ,
30- } ;
27+ use crate :: { helpers, subscription_manager:: SubscriptionEvent , usubscription} ;
3128
3229pub ( crate ) struct SubscriptionRequestHandler {
3330 subscription_sender : Sender < SubscriptionEvent > ,
34- notification_sender : Sender < NotificationEvent > ,
3531}
3632
3733impl SubscriptionRequestHandler {
38- pub ( crate ) fn new (
39- subscription_sender : Sender < SubscriptionEvent > ,
40- notification_sender : Sender < NotificationEvent > ,
41- ) -> Self {
34+ pub ( crate ) fn new ( subscription_sender : Sender < SubscriptionEvent > ) -> Self {
4235 Self {
4336 subscription_sender,
44- notification_sender,
4537 }
4638 }
4739}
@@ -108,25 +100,6 @@ impl RequestHandler for SubscriptionRequestHandler {
108100 ) ) ;
109101 } ;
110102
111- // Notify update channel
112- let ( respond_to, receive_from) = oneshot:: channel :: < ( ) > ( ) ;
113- if let Err ( e) = self
114- . notification_sender
115- . send ( NotificationEvent :: StateChange {
116- subscriber : source. clone ( ) ,
117- topic : subscription_request. topic . clone ( ) . unwrap_or_default ( ) ,
118- status : status. clone ( ) ,
119- respond_to,
120- } )
121- . await
122- {
123- error ! ( "Error initiating subscription-change update notification: {e}" ) ;
124- }
125- if let Err ( e) = receive_from. await {
126- // Not returning an error here, as update notification is not a core concern wrt the actual subscription management
127- warn ! ( "Error sending subscription-change update notification: {e}" ) ;
128- } ;
129-
130103 // Build and return result
131104 let response = SubscriptionResponse {
132105 topic : Some ( subscription_request. topic . unwrap_or_default ( ) ) . into ( ) ,
@@ -164,12 +137,9 @@ mod tests {
164137
165138 let ( subscription_sender, mut subscription_receiver) =
166139 mpsc:: channel :: < SubscriptionEvent > ( 1 ) ;
167- let ( notification_sender, mut notification_receiver) =
168- mpsc:: channel :: < NotificationEvent > ( 1 ) ;
169140
170141 // create and spawn off handler, to make all the asnync goodness work
171- let request_handler =
172- SubscriptionRequestHandler :: new ( subscription_sender, notification_sender) ;
142+ let request_handler = SubscriptionRequestHandler :: new ( subscription_sender) ;
173143 tokio:: spawn ( async move {
174144 let result = request_handler
175145 . handle_request (
@@ -207,28 +177,6 @@ mod tests {
207177 }
208178 _ => panic ! ( "Wrong event type" ) ,
209179 }
210-
211- // validate notification manager interaction
212- let notification_event = notification_receiver. recv ( ) . await . unwrap ( ) ;
213- match notification_event {
214- NotificationEvent :: StateChange {
215- subscriber,
216- topic,
217- status,
218- respond_to : _,
219- } => {
220- assert_eq ! ( subscriber, test_lib:: helpers:: subscriber_uri1( ) ) ;
221- assert_eq ! ( topic, test_lib:: helpers:: local_topic1_uri( ) ) ;
222- assert_eq ! (
223- status,
224- SubscriptionStatus {
225- state: State :: SUBSCRIBED . into( ) ,
226- ..Default :: default ( )
227- }
228- ) ;
229- }
230- _ => panic ! ( "Wrong event type" ) ,
231- }
232180 }
233181
234182 #[ tokio:: test]
@@ -245,11 +193,9 @@ mod tests {
245193 } ;
246194
247195 let ( subscription_sender, _) = mpsc:: channel :: < SubscriptionEvent > ( 1 ) ;
248- let ( notification_sender, _) = mpsc:: channel :: < NotificationEvent > ( 1 ) ;
249196
250197 // create handler and perform tested operation
251- let request_handler =
252- SubscriptionRequestHandler :: new ( subscription_sender, notification_sender) ;
198+ let request_handler = SubscriptionRequestHandler :: new ( subscription_sender) ;
253199
254200 let result = request_handler
255201 . handle_request (
@@ -276,11 +222,9 @@ mod tests {
276222 let request_payload = UPayload :: try_from_protobuf ( subscribe_request. clone ( ) ) . unwrap ( ) ;
277223
278224 let ( subscription_sender, _) = mpsc:: channel :: < SubscriptionEvent > ( 1 ) ;
279- let ( notification_sender, _) = mpsc:: channel :: < NotificationEvent > ( 1 ) ;
280225
281226 // create handler and perform tested operation
282- let request_handler =
283- SubscriptionRequestHandler :: new ( subscription_sender, notification_sender) ;
227+ let request_handler = SubscriptionRequestHandler :: new ( subscription_sender) ;
284228
285229 let result = request_handler
286230 . handle_request (
@@ -308,11 +252,9 @@ mod tests {
308252 } ;
309253
310254 let ( subscription_sender, _) = mpsc:: channel :: < SubscriptionEvent > ( 1 ) ;
311- let ( notification_sender, _) = mpsc:: channel :: < NotificationEvent > ( 1 ) ;
312255
313256 // create handler and perform tested operation
314- let request_handler =
315- SubscriptionRequestHandler :: new ( subscription_sender, notification_sender) ;
257+ let request_handler = SubscriptionRequestHandler :: new ( subscription_sender) ;
316258
317259 let result = request_handler
318260 . handle_request ( RESOURCE_ID_SUBSCRIBE , & message_attributes, None )
@@ -339,11 +281,9 @@ mod tests {
339281 } ;
340282
341283 let ( subscription_sender, _) = mpsc:: channel :: < SubscriptionEvent > ( 1 ) ;
342- let ( notification_sender, _) = mpsc:: channel :: < NotificationEvent > ( 1 ) ;
343284
344285 // create handler and perform tested operation
345- let request_handler =
346- SubscriptionRequestHandler :: new ( subscription_sender, notification_sender) ;
286+ let request_handler = SubscriptionRequestHandler :: new ( subscription_sender) ;
347287
348288 let result = request_handler
349289 . handle_request (
@@ -385,11 +325,9 @@ mod tests {
385325
386326 let ( subscription_sender, mut subscription_receiver) =
387327 mpsc:: channel :: < SubscriptionEvent > ( 1 ) ;
388- let ( notification_sender, _) = mpsc:: channel :: < NotificationEvent > ( 1 ) ;
389328
390329 // create and spawn off handler, to make all the asnync goodness work
391- let request_handler =
392- SubscriptionRequestHandler :: new ( subscription_sender, notification_sender) ;
330+ let request_handler = SubscriptionRequestHandler :: new ( subscription_sender) ;
393331 tokio:: spawn ( async move {
394332 let result = request_handler
395333 . handle_request (
@@ -450,11 +388,9 @@ mod tests {
450388 } ;
451389
452390 let ( subscription_sender, _) = mpsc:: channel :: < SubscriptionEvent > ( 1 ) ;
453- let ( notification_sender, _) = mpsc:: channel :: < NotificationEvent > ( 1 ) ;
454391
455392 // create handler and perform tested operation
456- let request_handler =
457- SubscriptionRequestHandler :: new ( subscription_sender, notification_sender) ;
393+ let request_handler = SubscriptionRequestHandler :: new ( subscription_sender) ;
458394
459395 let result = request_handler
460396 . handle_request (
0 commit comments