lsergio opened a new issue, #5158:
URL: https://github.com/apache/camel-k/issues/5158

   ### What happened?
   
   An integration that contains a more than 1 cron and is built using a CronJob 
stops before all the crons have had a chance to run
   
   ### Steps to reproduce
   
   Create an Integration that has 3 routes with the same schedules:
   ```
   apiVersion: camel.apache.org/v1
   kind: Integration
   metadata:
     name: demo001
   spec:
     sources:
     - name: flow1.groovy
       content: |-
         from('quartz://flow1/trigger?cron=0+*+*+?+*+*')
            .to("https://httpbin.org/delay/2?bridgeEndpoint=true";)
            .to("log:info")
     - name: flow2.groovy
       content: |-
         from('quartz://flow2/trigger?cron=0+*+*+?+*+*')
            .to("https://httpbin.org/delay/2?bridgeEndpoint=true";)
            .to("log:info")
     - name: flow3.groovy
       content: |-
         from('quartz://flow3/trigger?cron=0+*+*+?+*+*')
            .to("https://httpbin.org/delay/2?bridgeEndpoint=true";)
            .to("log:info")
     traits:
       logging:
         format: "[%-5p][%d{yyyy-MM-dd HH:mm:ssZ}] %s%e%n"
         json: false
   ```
   (These routes are all the same and were created to describe the problem only)
   
   Monitor the integration log, and check that:
   * All integrations are loaded
   * They run sequencially;
   * As soon as route1 finishes, Camel shuts down;
   * route2 still has a chance to run before Camel finishes the shutdown process
   * route3 is never run
   
   See the full log beflow
   
   
   
   ### Relevant log output
   
   ```shell
   [1] [INFO ][2024-02-15 19:04:02+0000] Apache Camel K Runtime 3.2.3
   [1] [INFO ][2024-02-15 19:04:02+0000] Bootstrap runtime: 
org.apache.camel.quarkus.main.CamelMainRuntime
   [1] [INFO ][2024-02-15 19:04:02+0000] Apache Camel (Main) 4.0.2 is starting
   [1] [INFO ][2024-02-15 19:04:02+0000] Loading routes from: 
SourceDefinition{name='flow1', language='groovy', interceptors='[cron]', 
type='source', location='file:/etc/camel/sources/flow1.groovy', }
   [1] [INFO ][2024-02-15 19:04:02+0000] Loading routes from: 
SourceDefinition{name='flow2', language='groovy', interceptors='[cron]', 
type='source', location='file:/etc/camel/sources/flow2.groovy', }
   [1] [INFO ][2024-02-15 19:04:02+0000] Loading routes from: 
SourceDefinition{name='flow3', language='groovy', interceptors='[cron]', 
type='source', location='file:/etc/camel/sources/flow3.groovy', }
   [1] [INFO ][2024-02-15 19:04:04+0000] No scheduled business methods found - 
Quartz scheduler will not be started
   [1] [INFO ][2024-02-15 19:04:04+0000] Apache Camel 4.0.2 (camel-1) is 
starting
   [1] [INFO ][2024-02-15 19:04:04+0000] Setting 
org.quartz.scheduler.jmx.export=true to ensure QuartzScheduler(s) will be 
enlisted in JMX
   [1] [INFO ][2024-02-15 19:04:04+0000] Routes startup (started:3)
   [1] [INFO ][2024-02-15 19:04:04+0000]     Started route1 
(timer://camel-k-cron-override)
   [1] [INFO ][2024-02-15 19:04:04+0000]     Started route2 
(timer://camel-k-cron-override)
   [1] [INFO ][2024-02-15 19:04:04+0000]     Started route3 
(timer://camel-k-cron-override)
   [1] [INFO ][2024-02-15 19:04:04+0000] Apache Camel 4.0.2 (camel-1) started 
in 165ms (build:0ms init:0ms start:165ms)
   [1] [INFO ][2024-02-15 19:04:04+0000] Starting Quartz scheduler: 
org.quartz.impl.StdScheduler@1e3dc24f
   [1] [INFO ][2024-02-15 19:04:04+0000] Waiting until complete: Duration idle 
5 seconds
   [1] [INFO ][2024-02-15 19:04:04+0000] camel-k-integration 2.2.0 on JVM 
(powered by Quarkus 3.2.9.Final) started in 3.748s. Listening on: 
http://0.0.0.0:8080
   [1] [INFO ][2024-02-15 19:04:04+0000] Profile prod activated. 
   [1] [INFO ][2024-02-15 19:04:04+0000] Installed features: [camel-bean, 
camel-cloudevents, camel-core, camel-cron, camel-groovy-dsl, camel-http, 
camel-k-core, camel-k-cron, camel-k-runtime, camel-knative, camel-kubernetes, 
camel-log, camel-quartz, cdi, groovy, kubernetes-client, quartz, scheduler, 
smallrye-context-propagation, vertx]
   [1] [INFO ][2024-02-15 19:04:06+0000] Exchange[ExchangePattern: InOnly, 
BodyType: byte[], Body: {  "args": {},   "data": "",   "files": {},   "form": 
{},   "headers": {    "Accept-Encoding": "gzip, x-gzip, deflate, br",     
"Firedtime": "Thu Feb 15 19:04:04 UTC 2024",     "Host": "httpbin.org",     
"User-Agent": "Apache-HttpClient/5.2.1 (Java/17.0.10)",     "X-Amzn-Trace-Id": 
"Root=1-65ce6024-5531383815de62254308a76d"  },   "origin": "52.54.30.147",   
"url": "https://httpbin.org/delay/2"}]
   [1] [INFO ][2024-02-15 19:04:06+0000] Initiate runtime shutdown
   [1] [INFO ][2024-02-15 19:04:06+0000] Shutting down the runtime
   [1] [INFO ][2024-02-15 19:04:06+0000] Apache Camel 4.0.2 (camel-1) is 
shutting down (timeout:45s)
   [1] [INFO ][2024-02-15 19:04:06+0000] Waiting as there are still 1 inflight 
and pending exchanges to complete, timeout in 45 seconds. Inflights per route: 
[route2 = 1]
   [1] [INFO ][2024-02-15 19:04:07+0000] Waiting as there are still 1 inflight 
and pending exchanges to complete, timeout in 44 seconds. Inflights per route: 
[route2 = 1]
   [1] [INFO ][2024-02-15 19:04:08+0000] Exchange[ExchangePattern: InOnly, 
BodyType: byte[], Body: {  "args": {},   "data": "",   "files": {},   "form": 
{},   "headers": {    "Accept-Encoding": "gzip, x-gzip, deflate, br",     
"Firedtime": "Thu Feb 15 19:04:06 UTC 2024",     "Host": "httpbin.org",     
"User-Agent": "Apache-HttpClient/5.2.1 (Java/17.0.10)",     "X-Amzn-Trace-Id": 
"Root=1-65ce6026-1318a4aa53136e546e8bfd7c"  },   "origin": "52.54.30.147",   
"url": "https://httpbin.org/delay/2"}]
   [1] [INFO ][2024-02-15 19:04:08+0000] Initiate runtime shutdown
   [1] [INFO ][2024-02-15 19:04:08+0000] Shutting down the runtime
   [1] [INFO ][2024-02-15 19:04:08+0000] Routes stopped (stopped:3)
   [1] [INFO ][2024-02-15 19:04:08+0000]     Stopped route3 
(timer://camel-k-cron-override)
   [1] [INFO ][2024-02-15 19:04:08+0000]     Stopped route2 
(timer://camel-k-cron-override)
   [1] [INFO ][2024-02-15 19:04:08+0000]     Stopped route1 
(timer://camel-k-cron-override)
   [1] [INFO ][2024-02-15 19:04:08+0000] Shutting down Quartz scheduler (will 
wait for all jobs to complete first)
   [1] [INFO ][2024-02-15 19:04:08+0000] Apache Camel 4.0.2 (camel-1) shutdown 
in 2s63ms (uptime:4s)
   [1] [INFO ][2024-02-15 19:04:08+0000] camel-k-integration stopped in 2.094s
   ```
   
   
   ### Camel K version
   
   2.2.0


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to