Unai, I have been able to talk this through with some of the NIF SME’s and the TL;DR is:
There is ample precedence for this and it can be done, though it does open up the possibility for problems with resource consumption. We can take this back to your PLC4x pr. On May 17, 2023 at 3:55:53 PM, Unai Leria (unai.le...@zylk.net.invalid) wrote: Hi Otto, At the moment all available PLC4X subscriptions work when the protocol used supports them natively. The processor would start a single thread listening for incoming PLC messages. The PLC4X community was planning to add subscription to all protocols when not natively supported via polling, but it is not currently implemented and seems like it will take time. In this case I suppose 2 to 3 threads could be launched per processor. However to mimic the subscription with the current PLC4X integration (with only the reading processor) would require around 3 more standard processors so I don't see a big difference. Unai On 2023/05/17 15:32:24 Otto Fowler wrote: > Hi Unai! > > Would this be a single thread, just listening? Is this pure exception based > processing ( where you only listen for things ) or is it possible to have > to simulate this by polling some of the endpoints? > > On May 17, 2023 at 10:28:24 AM, Unai Leria (unai.le...@zylk.net.invalid) > wrote: > > Hi NiFi community! br/> < > > I'm working on a PLC subscriber/listener processor to improve the > Apache/PLC4X's NiFi integration and a questions about the possible > implementation have raised on the PLC4x community br/>The processor can be > found here: [ > https://github.com/zylklab/plc4x/blob/feature/nifi-integration-record-listener/plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xListenRecordProcessor.java > | > https://github.com/zylklab/plc4x/blob/feature/nifi-integration-record-listener/plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xListenRecordProcessor.java > ] br/> < > At the moment I have made the processor trying to follow the already > implemented listeners in NiFi: starting a daemon thread with a dispatcher > that connects to the PCL and waits for messages. br/>That disppatcher puts > events into a queue from which the processor reads and creates FlowFiles. > br/> < > The main question is if creating a thread for every processor that are not > in the thread pools and governed by the Nifi scheduler is a bad idea. And > what could be the effects be on a NiFi instance of multiple of this > processors. br/> < > > Any thoughts would be greatly appreciated! br/> < > Thank you for your time, br/> < > Unai Lería br/> < >