gansheer commented on issue #5088:
URL: https://github.com/apache/camel-k/issues/5088#issuecomment-1912384954

   The mechanism used is the following:
   - camel-k identifies if the integration start with a timer, cron or quartz 
component and creates a cronjob if the cron expression is valid. This is the 
part that works in both JVM and native modes.
   - camel-k-runtime replace at runtime the original timer, cron or quartz 
component expression in the source by the following one 
`timer:camel-k-cron-override?delay=0&period=1&repeatCount=1`. That's where it 
fails in native mode. This replacement needs the source file available at 
runtime, which can not be possible with native build since it is integrated at 
build and is part of the executable.
   
   A refactoring is in progress to remove the camel-k-runtime dependency 
(#4024), and the cron trait part it contains will be adapted.
   
   For now if you need to have the native version working I suggest to manually 
do the change directly in the integration:
   ```
   ...
     sources:
     - name: main.groovy
       content: |-
         from("timer:camel-k-cron-override?delay=0&period=1&repeatCount=1")
             .to("direct:start")
   
         from("direct:start")
           .to("https://httpbin.org/delay/2?bridgeEndpoint=true";)
           .to("log:info")
     traits:
       cron:
         enabled: true
         schedule: "* * * * ?"
         components: ""
   ...
   ```
   
   This should give you the same result for JVM and native builds. 


-- 
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

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

Reply via email to