You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Etienne Robinet <er...@apache.org> on 2020/05/06 12:48:39 UTC

Scraper

Hello guys,
I was looking a bit at the actual Scraper we have in 'tools'. I tested a scheduled Read via YAML file and it worked just fine. However when I try to create a triggered-read, I get an error:

[main] INFO org.apache.plc4x.java.PlcDriverManager - Instantiating new PLC Driver Manager with class loader jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd
[main] INFO org.apache.plc4x.java.PlcDriverManager - Registering available drivers...
[main] INFO org.apache.plc4x.java.PlcDriverManager - Registering driver for Protocol s7 (Siemens S7 (Basic))
[main] INFO org.apache.plc4x.java.transport.tcp.TcpChannelFactory - Configuring Bootstrap with Configuration{local-rack=1, local-slot=1, remote-rack=0, remot-slot=0, pduSize=1024, maxAmqCaller=8, maxAmqCallee=8, controllerType='null'}
[main] WARN org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.collector.TriggerCollectorImpl - The Triggered Scraper is intended to be used with a Pooled Connection. In other situations leaks could occur!
[main] INFO org.apache.plc4x.java.PlcDriverManager - Instantiating new PLC Driver Manager with class loader jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd
[main] INFO org.apache.plc4x.java.PlcDriverManager - Registering available drivers...
[main] INFO org.apache.plc4x.java.PlcDriverManager - Registering driver for Protocol s7 (Siemens S7 (Basic))
[main] INFO org.apache.plc4x.java.scraper.config.triggeredscraper.ScraperConfigurationTriggeredImpl - Assuming job as triggered job because triggerConfig has been set
org.apache.plc4x.java.scraper.exception.ScraperConfigurationException: Null plc-trigger variable used
	at org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.TriggerConfiguration.validateDataType(TriggerConfiguration.java:167)
	at org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.TriggerConfiguration.access$200(TriggerConfiguration.java:37)
	at org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.TriggerConfiguration$TriggerElement.convertCompareValue(TriggerConfiguration.java:562)
	at org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.TriggerConfiguration$TriggerElement.<init>(TriggerConfiguration.java:545)
	at org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.TriggerConfiguration.createConfiguration(TriggerConfiguration.java:386)
	at org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScrapeJobImpl.<init>(TriggeredScrapeJobImpl.java:42)
	at org.apache.plc4x.java.scraper.config.triggeredscraper.ScraperConfigurationTriggeredImpl.getJobs(ScraperConfigurationTriggeredImpl.java:99)
	at org.apache.plc4x.java.scraper.config.triggeredscraper.ScraperConfigurationTriggeredImpl.getJobs(ScraperConfigurationTriggeredImpl.java:88)
	at org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperImpl.<init>(TriggeredScraperImpl.java:95)
	at Test.main(Test.java:27)

After some debugging it seems like the PlcField for the trigger is not set (so it's null). Anyone who worked on this has an idea? Or maybe I'm using the config file wrong, here is what I have:

sources:
  S7: s7://192.168.178.10

jobs:
  - name: triggered-demo-job1
    triggerConfig: (S7_TRIGGER_VAR,10,(%M200.0:BOOL)==(true))
    sources:
      - S7
    fields:
      test2: '%DB1.DBW2:INT'

Etienne

Re: Scraper

Posted by Etienne Robinet <er...@apache.org>.
Hi guys,
just wanted to make a small update. I added a "generic" trigger (mostly for naming) and did some changes so it can be used with the new drivers.
I tested this on an S7 and Allen-Bradley PLC, and both worked!
I did the changes in the "feature/scraper" branch, but I think it would need a bit of cleaning. And if you guys are ok with the way it is, I could try and use the scraper with Camel.

Etienne

On 2020/05/06 12:48:39, Etienne Robinet <er...@apache.org> wrote: 
> Hello guys,
> I was looking a bit at the actual Scraper we have in 'tools'. I tested a scheduled Read via YAML file and it worked just fine. However when I try to create a triggered-read, I get an error:
> 
> [main] INFO org.apache.plc4x.java.PlcDriverManager - Instantiating new PLC Driver Manager with class loader jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd
> [main] INFO org.apache.plc4x.java.PlcDriverManager - Registering available drivers...
> [main] INFO org.apache.plc4x.java.PlcDriverManager - Registering driver for Protocol s7 (Siemens S7 (Basic))
> [main] INFO org.apache.plc4x.java.transport.tcp.TcpChannelFactory - Configuring Bootstrap with Configuration{local-rack=1, local-slot=1, remote-rack=0, remot-slot=0, pduSize=1024, maxAmqCaller=8, maxAmqCallee=8, controllerType='null'}
> [main] WARN org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.collector.TriggerCollectorImpl - The Triggered Scraper is intended to be used with a Pooled Connection. In other situations leaks could occur!
> [main] INFO org.apache.plc4x.java.PlcDriverManager - Instantiating new PLC Driver Manager with class loader jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd
> [main] INFO org.apache.plc4x.java.PlcDriverManager - Registering available drivers...
> [main] INFO org.apache.plc4x.java.PlcDriverManager - Registering driver for Protocol s7 (Siemens S7 (Basic))
> [main] INFO org.apache.plc4x.java.scraper.config.triggeredscraper.ScraperConfigurationTriggeredImpl - Assuming job as triggered job because triggerConfig has been set
> org.apache.plc4x.java.scraper.exception.ScraperConfigurationException: Null plc-trigger variable used
> 	at org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.TriggerConfiguration.validateDataType(TriggerConfiguration.java:167)
> 	at org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.TriggerConfiguration.access$200(TriggerConfiguration.java:37)
> 	at org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.TriggerConfiguration$TriggerElement.convertCompareValue(TriggerConfiguration.java:562)
> 	at org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.TriggerConfiguration$TriggerElement.<init>(TriggerConfiguration.java:545)
> 	at org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler.TriggerConfiguration.createConfiguration(TriggerConfiguration.java:386)
> 	at org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScrapeJobImpl.<init>(TriggeredScrapeJobImpl.java:42)
> 	at org.apache.plc4x.java.scraper.config.triggeredscraper.ScraperConfigurationTriggeredImpl.getJobs(ScraperConfigurationTriggeredImpl.java:99)
> 	at org.apache.plc4x.java.scraper.config.triggeredscraper.ScraperConfigurationTriggeredImpl.getJobs(ScraperConfigurationTriggeredImpl.java:88)
> 	at org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperImpl.<init>(TriggeredScraperImpl.java:95)
> 	at Test.main(Test.java:27)
> 
> After some debugging it seems like the PlcField for the trigger is not set (so it's null). Anyone who worked on this has an idea? Or maybe I'm using the config file wrong, here is what I have:
> 
> sources:
>   S7: s7://192.168.178.10
> 
> jobs:
>   - name: triggered-demo-job1
>     triggerConfig: (S7_TRIGGER_VAR,10,(%M200.0:BOOL)==(true))
>     sources:
>       - S7
>     fields:
>       test2: '%DB1.DBW2:INT'
> 
> Etienne
>