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

bossenti pushed a commit to branch 2856-file-stream-adapter
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/2856-file-stream-adapter by 
this push:
     new 9a735e872c minor adaptions
9a735e872c is described below

commit 9a735e872cce557fbcfc8dc5150a988298991a0e
Author: bossenti <[email protected]>
AuthorDate: Mon May 13 13:56:12 2024 +0200

    minor adaptions
---
 .../connect/iiot/protocol/stream/FileReplayAdapter.java           | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/FileReplayAdapter.java
 
b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/FileReplayAdapter.java
index 25194dbb20..f6b1fc7721 100644
--- 
a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/FileReplayAdapter.java
+++ 
b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/FileReplayAdapter.java
@@ -246,7 +246,7 @@ public class FileReplayAdapter implements 
StreamPipesAdapter {
 
             long actualEventTimestamp = -1;
             try {
-              actualEventTimestamp = (long) 
event.get(timestampSourceFieldName);
+              actualEventTimestamp = (int) event.get(timestampSourceFieldName);
             } catch (ClassCastException e) {
               adapterRuntimeContext
                   .getLogger()
@@ -256,9 +256,11 @@ public class FileReplayAdapter implements 
StreamPipesAdapter {
                       ));
             }
 
-            if (timestampLastEvent == -1) {
+            if (actualEventTimestamp == -1) {
               return;
-            } else {
+            }
+
+            if (timestampLastEvent != -1) {
               long sleepTime = (long) ((actualEventTimestamp - 
timestampLastEvent) / speedUp);
               // speed up is set to Float.MAX_VALUE when user selected fastest 
option
               if (sleepTime > 0 && speedUp != Float.MAX_VALUE) {

Reply via email to