@@ -4,6 +4,8 @@ use crate::flow::FlowOutput;
44use crate :: flow:: FlowResult ;
55use crate :: flow:: Message ;
66use crate :: flow:: SourceTag ;
7+ use crate :: registry:: BaseFlowRegistry ;
8+ use crate :: registry:: FlowRegistryExt ;
79use crate :: runtime:: MessageProcessor ;
810use crate :: InputMessage ;
911use crate :: Tick ;
@@ -44,7 +46,7 @@ pub struct FlowsMapper {
4446 pub ( super ) watch_request_sender : DynSender < WatchRequest > ,
4547 pub ( super ) subscriptions : TopicFilter ,
4648 pub ( super ) watched_commands : HashSet < String > ,
47- pub ( super ) processor : MessageProcessor ,
49+ pub ( super ) processor : MessageProcessor < BaseFlowRegistry > ,
4850 pub ( super ) next_dump : Instant ,
4951}
5052
@@ -174,16 +176,16 @@ impl FlowsMapper {
174176 async fn notify_flows_status ( & mut self ) -> Result < ( ) , RuntimeError > {
175177 let status = "enabled" ;
176178 let now = OffsetDateTime :: now_utc ( ) ;
177- for flow in self . processor . flows . keys ( ) {
178- let status = Self :: flow_status ( flow, status, & now) ;
179+ for flow in self . processor . registry . flows ( ) {
180+ let status = Self :: flow_status ( flow. name ( ) , status, & now) ;
179181 self . mqtt_sender . send ( status) . await ?;
180182 }
181183 Ok ( ( ) )
182184 }
183185
184186 async fn update_flow_status ( & mut self , flow : & str ) -> Result < ( ) , RuntimeError > {
185187 let now = OffsetDateTime :: now_utc ( ) ;
186- let status = if self . processor . flows . contains_key ( flow) {
188+ let status = if self . processor . registry . contains_flow ( flow) {
187189 "updated"
188190 } else {
189191 "removed"
@@ -270,7 +272,7 @@ impl FlowsMapper {
270272 flow_name : String ,
271273 line : String ,
272274 ) -> Result < ( ) , RuntimeError > {
273- if let Some ( flow) = self . processor . registry . get ( & flow_name) {
275+ if let Some ( flow) = self . processor . registry . flow ( & flow_name) {
274276 let topic = flow. input . enforced_topic ( ) . unwrap_or_default ( ) ;
275277 let source = SourceTag :: Process {
276278 flow : flow_name. clone ( ) ,
@@ -286,7 +288,7 @@ impl FlowsMapper {
286288 flow_name : & str ,
287289 error : FlowError ,
288290 ) -> Result < ( ) , RuntimeError > {
289- let Some ( ( info, flow_error) ) = self . processor . registry . get ( flow_name) . map ( |flow| {
291+ let Some ( ( info, flow_error) ) = self . processor . registry . flow ( flow_name) . map ( |flow| {
290292 (
291293 format ! ( "Reconnecting input: {flow_name}: {}" , flow. input) ,
292294 flow. on_error ( error) ,
@@ -299,7 +301,7 @@ impl FlowsMapper {
299301 let Some ( request) = self
300302 . processor
301303 . registry
302- . get ( flow_name)
304+ . flow ( flow_name)
303305 . and_then ( |flow| flow. watch_request ( ) )
304306 else {
305307 return Ok ( ( ) ) ;
@@ -315,7 +317,7 @@ impl FlowsMapper {
315317 }
316318
317319 async fn on_process_eos ( & mut self , flow_name : & str ) -> Result < ( ) , RuntimeError > {
318- if let Some ( flow) = self . processor . registry . get ( flow_name) {
320+ if let Some ( flow) = self . processor . registry . flow ( flow_name) {
319321 if let Some ( request) = flow. watch_request ( ) {
320322 info ! ( target: "flows" , "Reconnecting input: {flow_name}: {}" , flow. input) ;
321323 self . watch_request_sender . send ( request) . await ?
0 commit comments