This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch rel/0.95.0
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/rel/0.95.0 by this push:
     new 858b11f961 fix: Fix timeout in OI4 adapter
858b11f961 is described below

commit 858b11f9610e88ea1c77a382aeeb0664804b22d4
Author: Dominik Riemer <[email protected]>
AuthorDate: Fri May 10 10:57:07 2024 +0200

    fix: Fix timeout in OI4 adapter
---
 .../apache/streampipes/connect/iiot/adapters/oi4/Oi4Adapter.java   | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git 
a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/oi4/Oi4Adapter.java
 
b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/oi4/Oi4Adapter.java
index 52d0b41fc1..06bd974c6c 100644
--- 
a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/oi4/Oi4Adapter.java
+++ 
b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/oi4/Oi4Adapter.java
@@ -272,7 +272,7 @@ public class Oi4Adapter implements StreamPipesAdapter {
     thread.setUncaughtExceptionHandler((t, e) -> 
exceptionRef.set(e.getCause()));
     thread.start();
 
-    while (sampleMessages.isEmpty() && exceptionRef.get() == null && 
timeElapsed < ReceiveSchemaSleepTime) {
+    while (sampleMessages.isEmpty() && exceptionRef.get() == null && 
timeElapsed < ReceiveSchemaMaxTimeout) {
       try {
         TimeUnit.MILLISECONDS.sleep(ReceiveSchemaSleepTime);
         timeElapsed += ReceiveSchemaSleepTime;
@@ -338,15 +338,12 @@ public class Oi4Adapter implements StreamPipesAdapter {
 
           // an empty list of selected sensors means that we want to collect 
data from all sensors available
           if (selectedSensors.isEmpty() || selectedSensors.contains(sensorId)) 
{
-
             return extractAndEnrichMessagePayload(dataMessage, sensorId);
           }
-        } else {
-          throw new ParseException(String.format("No sensor of type %s found 
in message", givenSensorType));
         }
       }
     }
-    throw new ParseException("No process data message");
+    throw new ParseException(String.format("No sensor of type %s found in 
message", givenSensorType));
   }
 
   private List<DataSetMessage> findProcessDataInputMessage(NetworkMessage 
message) {

Reply via email to