Hi Unai, currently only protocoly actively supporting subscriptions implement the Subscription API. We were planning on adding a transparent polling emulation of subscriptions for protocols, that don’t natively support them, however. But I guess that’s still going to take quite some time till we implement that.
Chris Von: Unai Leria <[email protected]> Datum: Donnerstag, 4. Mai 2023 um 09:37 An: Otto Fowler <[email protected]>, dev <[email protected]> Betreff: Re: [Opinion] NiFi integration Listener The idea is that the processor only allows the use of plc4x subscription requests. It would only work on drivers that support subscription. I have made the assumption that the all plc4x subscriptions implementations are optimized listeners and are not based only on continuous polling. De: "Otto Fowler" <[email protected]> Para: "dev" <[email protected]>, "unai leria" <[email protected]> Enviados: Miércoles, 3 de Mayo 2023 16:38:08 Asunto: Re: [Opinion] NiFi integration Listener So this would be a plc4x subscription listener not something polling? I don’t think that is a bad idea overall, as long as it is true Unsolicited / subscription / Exception based processing and not polling in a background thread. On May 3, 2023 at 4:36:03 AM, Unai Leria ( [ mailto:[email protected] | [email protected] ] ) wrote: Hi Otto! The idea was to use the processor to support plc4x subscriptions. Maybe the "listener" name was not the most appropriate one but I was trying to follow the NiFi naming convention. Sorry for the misunderstanding Unai ----- Mensaje original ----- De: "Otto Fowler" < [ mailto:[email protected] | [email protected] ] > Para: "dev" < [ mailto:[email protected] | [email protected] ] >, "unai leria" < [ mailto:[email protected] | [email protected] ] > Enviados: Miércoles, 3 de Mayo 2023 3:53:17 Asunto: Re: [Opinion] NiFi integration Listener On May 2, 2023 at 9:52:08 PM, Otto Fowler ( [ mailto:[email protected] | [email protected] ] ) wrote: Hi Unai! So, this listener would listen for exception based or unsolicited messages? If it is just polling on a background thread, I don’t think how you want to do something in nifi, and we already have “polling” processors. On May 2, 2023 at 11:09:33 AM, Unai Leria ([email protected]) wrote: Hi br/> < I have been taking a look into the possibility of adding a PLC4x Listener to the NiFi integration. br/> < Under my research, and following how most of the ListenXXX processors in the standard-bundle of NiFi are, a good solution would be: * A processor that starts a thread when it is scheduled. * That thread connects to the plc and appends the messages received into a queue. br/> * The processor reads the messages from thiis queue only running when not empty. br/> < In particular ListenTCP and ListenUDP would be the closest ones to the implementation I describe. br/> < In order to account for inevitable disconnections I suggest including an additional queue prior to the queue that connects to the processor. Its function would be to check if the time to the last event is greater than x amount and reconnect in that case. br/> < As a proof of concept I already have a working version on [ https://github.com/zylklab/plc4x/tree/feature/nifi-integration-record-listener | https://github.com/zylklab/plc4x/tree/feature/nifi-integration-record-listener ] . br/> < I would appreciate your opinion on this feature. br/>If you like it I can create a PR. br/> < Thanks you for your time! br/> < Unai Lería br/>
