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

   ### What happened?
   
   We use the `enrich`-EIP to call another route to obtain credentials for 
accessing web services. Basically the flow looks like this:
   
       copy_body = {
       
         Exchange original, Exchange otherExchange -> 
original.in.setBody(otherExchange.in.getBody())
   
       }
       
       
       from("cron://run_daily?schedule=0+5+*+*+?")
          .enrich("direct:subroute", copy_body)
      
   
       from("direct:subroute")
        .setBody(constant('direct: route called'))
    
   This code fails with the error message:
   
       Caused by: org.apache.camel.RuntimeCamelException: Cannot produce to a 
TimerEndpoint: timer://camel-k-overridden-cron?delay=0&period=1&repeatCount=1
            at 
org.apache.camel.component.timer.TimerEndpoint.createProducer(TimerEndpoint.java:97)
   
   Looking at the Groovy code reveals that the cron trait not only replaces 
from("cron:...") endpoint but also the from("direct:...") - and the endpoint in 
the enrich call enrich("direct:..."). 
   
       copy_body = {
       
         Exchange original, Exchange otherExchange -> 
original.in.setBody(otherExchange.in.getBody())
   
       }
       
       
       from("timer:camel-k-overridden-cron?delay=0&period=1&repeatCount=1")
          
.enrich("timer:camel-k-overridden-cron?delay=0&period=1&repeatCount=1", 
copy_body)
      
   
       from("timer:camel-k-overridden-cron?delay=0&period=1&repeatCount=1")
        .setBody(constant('direct: route called'))
   
   This causes the error above.
   
   ### Steps to reproduce
   
   _No response_
   
   ### Relevant log output
   
   ```shell
   
   ```
   
   ### Camel K version
   
   2.6.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