Francesco Spampinato created CAMEL-24171:
--------------------------------------------

             Summary: [camel-plc4x]  Plc4XEndpoint doStart called multiple times
                 Key: CAMEL-24171
                 URL: https://issues.apache.org/jira/browse/CAMEL-24171
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 4.21.0
            Reporter: Francesco Spampinato


Hi, 

I'm using camel-plc4x to acquire data from plc machines with a camel 
integration.

In particular i'm using modbus and s7 protocols to acquire data.

 
{code:java}
from(timer("modbus").period(5000))
.pollEnrich(plc4x("modbus-tcp://localhost:502")
.autoReconnect(true)
.tags(Map.of("coil-1", "RAW(coil:1)")), 5000)
.routeId("modbus")
.log(LoggingLevel.INFO, LOG, ">> Message from modbus ${body}");  {code}
 
{code:java}
from(timer("s7").period(5000))
.pollEnrich(plc4x("s7://localhost:102")
.autoReconnect(true)
.tags(Map.of("var1", "RAW(%DB1.DBX0.0:BOOL)")), 5000)
.routeId("s7")
.log(LoggingLevel.INFO, LOG, ">> Message from s7${body}");  {code}
In the modbus route Plc4XEndpoint is started only once when the routes start's 
up.

This method is only called once 
{code:java}
@Override    
protected void doStart() throws Exception {
  super.doStart();        
  ClassLoader cl = getCamelContext().getApplicationContextClassLoader();
  this.plcDriverManager = new DefaultPlcDriverManager(cl);    
} {code}
In the s7 routes instead, doStart is called on every poll cycle, causing 
DefaultPlcDriverManager to be reinstantiated and forced to reload all available 
plc protocols.

 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to