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

pcongiusti pushed a commit to branch release-1.15.x
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git


The following commit(s) were added to refs/heads/release-1.15.x by this push:
     new d6e01626 fix(cron): gracefully stop when all exchanges are processed
d6e01626 is described below

commit d6e016265aae1500b753d37c902c228add332a7e
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Fri May 19 12:39:32 2023 +0200

    fix(cron): gracefully stop when all exchanges are processed
    
    Closes https://github.com/apache/camel-k/issues/4343
---
 .../main/java/org/apache/camel/k/cron/CronSourceLoaderInterceptor.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/camel-k-cron/impl/src/main/java/org/apache/camel/k/cron/CronSourceLoaderInterceptor.java
 
b/camel-k-cron/impl/src/main/java/org/apache/camel/k/cron/CronSourceLoaderInterceptor.java
index 8616249b..dd36f0e0 100644
--- 
a/camel-k-cron/impl/src/main/java/org/apache/camel/k/cron/CronSourceLoaderInterceptor.java
+++ 
b/camel-k-cron/impl/src/main/java/org/apache/camel/k/cron/CronSourceLoaderInterceptor.java
@@ -131,7 +131,8 @@ public class CronSourceLoaderInterceptor implements 
RouteBuilderLifecycleStrateg
 
         @Override
         public boolean isEnabled(CamelEvent event) {
-            return event instanceof CamelEvent.ExchangeCompletedEvent || event 
instanceof CamelEvent.ExchangeFailedEvent;
+            return (event instanceof CamelEvent.ExchangeCompletedEvent || 
event instanceof CamelEvent.ExchangeFailedEvent)
+                && 
this.runtime.getCamelContext().getInflightRepository().size() == 0;
         }
     }
 }

Reply via email to