You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/05/28 12:06:11 UTC

[camel] branch master updated: CAMEL-13587: Inflight repository browse should compute elapsed if the message is still inflight at a given node. Thanks to Barbara De Vido for reporting.

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

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 02b2f26  CAMEL-13587: Inflight repository browse should compute elapsed if the message is still inflight at a given node. Thanks to Barbara De Vido for reporting.
02b2f26 is described below

commit 02b2f265a57b757155757fc330c1d7108574bcfa
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue May 28 14:03:48 2019 +0200

    CAMEL-13587: Inflight repository browse should compute elapsed if the message is still inflight at a given node. Thanks to Barbara De Vido for reporting.
---
 core/camel-api/src/main/java/org/apache/camel/MessageHistory.java  | 1 +
 .../org/apache/camel/impl/engine/DefaultInflightRepository.java    | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/MessageHistory.java b/core/camel-api/src/main/java/org/apache/camel/MessageHistory.java
index 6086508..93b4fb2 100644
--- a/core/camel-api/src/main/java/org/apache/camel/MessageHistory.java
+++ b/core/camel-api/src/main/java/org/apache/camel/MessageHistory.java
@@ -38,6 +38,7 @@ public interface MessageHistory {
 
     /**
      * Gets the elapsed time in millis processing the node took
+     * (this is 0 until the node processing is done)
      */
     long getElapsed();
 
diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInflightRepository.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInflightRepository.java
index 516b86e..b05eb90 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInflightRepository.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInflightRepository.java
@@ -212,7 +212,12 @@ public class DefaultInflightRepository extends ServiceSupport implements Infligh
             // get latest entry
             MessageHistory history = list.getLast();
             if (history != null) {
-                return history.getElapsed();
+                long elapsed = history.getElapsed();
+                if (elapsed == 0 && history.getTime() > 0) {
+                    // still in progress, so lets compute it via the start time
+                    elapsed = System.currentTimeMillis() - history.getTime();
+                }
+                return elapsed;
             } else {
                 return 0;
             }