@@ -3,14 +3,17 @@ use reqwest_eventsource::{Event, EventSource};
33use secrecy:: ExposeSecret ;
44
55use intersect_ingress_proxy_common:: intersect_messaging:: extract_eventsource_data;
6- use intersect_ingress_proxy_common:: protocols:: ProtoHandler ;
6+ use intersect_ingress_proxy_common:: protocols:: interfaces :: PublishProtoHandler ;
77use intersect_ingress_proxy_common:: server_paths:: SUBSCRIBE_URL ;
88use intersect_ingress_proxy_common:: signals:: wait_for_os_signal;
99
1010use crate :: configuration:: ExternalProxy ;
1111
1212/// Return Err only if we weren't able to publish a correct message to the broker, invalid messages are ignored
13- async fn send_message ( message : String , proto_handler : & impl ProtoHandler ) -> Result < ( ) , & str > {
13+ async fn send_message (
14+ message : String ,
15+ proto_handler : & impl PublishProtoHandler ,
16+ ) -> Result < ( ) , & str > {
1417 let es_data_result = extract_eventsource_data ( & message) ;
1518 if es_data_result. is_err ( ) {
1619 return Ok ( ( ) ) ;
@@ -26,7 +29,7 @@ async fn send_message(message: String, proto_handler: &impl ProtoHandler) -> Res
2629/// - Inner API could potentially panic but is currently not expected to do so
2730pub async fn event_source_loop (
2831 other_proxy : ExternalProxy ,
29- connection_pool : & impl ProtoHandler ,
32+ proto_handler : impl PublishProtoHandler ,
3033) -> i32 {
3134 let mut es = EventSource :: new (
3235 reqwest:: Client :: new ( )
@@ -55,7 +58,7 @@ pub async fn event_source_loop(
5558 tracing:: info!( "connected to {}" , & other_proxy. url) ;
5659 } ,
5760 Ok ( Event :: Message ( message) ) => {
58- if let Err ( e) = send_message( message. data, connection_pool ) . await {
61+ if let Err ( e) = send_message( message. data, & proto_handler ) . await {
5962 tracing:: error!( e) ;
6063 } ;
6164 } ,
0 commit comments