Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timer not fired in native mode #683

Closed
jstakun opened this issue Feb 5, 2020 · 6 comments
Closed

Timer not fired in native mode #683

jstakun opened this issue Feb 5, 2020 · 6 comments

Comments

@jstakun
Copy link

jstakun commented Feb 5, 2020

Hello

I've got route initated by timer. In java mode it works fine, but in native mode it doesn't seem to be initiated. Even simple test fails in native mode:

<route id="timer-test-route"> <from id="timer-test" uri="timer://testTimer?period=10s"/> <log id="_log41" message="this test timer is fired every 10 second"/> </route>

$ ./wildwest-bot-1.0.0-SNAPSHOT-runner

2020-02-05 17:55:44,449 INFO [org.apa.cam.mai.BaseMainSupport] (main) Auto-configuration summary:
2020-02-05 17:55:44,449 INFO [org.apa.cam.mai.BaseMainSupport] (main) camel.main.xmlroutes=classpath:/spring/camel-routes.xml
2020-02-05 17:55:44,449 INFO [org.apa.cam.mai.BaseMainSupport] (main) camel.context.name=wildwest-bot
2020-02-05 17:55:44,449 INFO [org.apa.cam.qua.cor.CamelRoutesCollector] (main) Loading additional Camel XML routes from: classpath:/spring/camel-routes.xml
2020-02-05 17:55:44,449 INFO [org.apa.cam.qua.cor.FastCamelContext] (main) Apache Camel 3.0.1 (CamelContext: wildwest-bot) is starting
2020-02-05 17:55:44,449 INFO [org.apa.cam.imp.eng.DefaultManagementStrategy] (main) JMX is disabled
2020-02-05 17:55:44,449 INFO [org.apa.cam.qua.cor.FastCamelContext] (main) StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
2020-02-05 17:55:44,450 INFO [org.apa.cam.qua.cor.FastCamelContext] (main) Total 0 routes, of which 0 are started
2020-02-05 17:55:44,450 INFO [org.apa.cam.qua.cor.FastCamelContext] (main) Apache Camel 3.0.1 (CamelContext: wildwest-bot) started in 0.001 seconds
2020-02-05 17:55:44,450 INFO [io.quarkus] (main) wildwest-bot 1.0.0-SNAPSHOT (running on Quarkus 1.2.0.Final) started in 0.006s.
2020-02-05 17:55:44,450 INFO [io.quarkus] (main) Profile prod activated.
2020-02-05 17:55:44,450 INFO [io.quarkus] (main) Installed features: [camel-bean, camel-core, camel-direct, camel-jackson, camel-log, camel-netty, camel-netty-http, camel-support-common, camel-support-xml, camel-timer, camel-xml, cdi]

I'm using quarkus 1.2.0.Final, camel-quarkus 1.0.0-M3 and GraalVM 19.3.1
Please advice.

@oscerd
Copy link
Contributor

oscerd commented Feb 5, 2020

Can you show what you have in your POM?

@jstakun
Copy link
Author

jstakun commented Feb 5, 2020

https://github.com/jstakun/wildwest-bot/blob/quarkus/wildwest-bot/pom.xml
Actually it seems from the log my route is not started at all

@jstakun
Copy link
Author

jstakun commented Feb 6, 2020

What should be correct value for camel.main.xml-routes

In examples you are using:

camel.main.xml-routes = file:src/main/resources/routes/my-routes.xml

But this doesn't work for me in both java and native mode.
I've tried:

camel.main.xml-routes = classpath:/spring/camel-routes.xml

and this works for me only in java mode

@lburgazzoli
Copy link
Contributor

camel.main.xml-routes is a runtime property so

  • if you use file scheme, the file files should be readable by the application when the application runs, maybe you need to check from where the application is started and see if you can read that file.
  • if you use the classpath, then you need to embed the file in the native image, otherwise if won't be available from the classpath, see this guide for more info

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Feb 6, 2020

I did try the example we provide and everything works in both native and jvm mode.

Native log:

$ ./target/camel-quarkus-examples-timer-log-xml-1.1.0-SNAPSHOT-runner
2020-02-06 09:57:51,639 DEBUG [org.apa.cam.mai.BaseMainSupport] (main) Properties from Camel properties component:
2020-02-06 09:57:51,639 DEBUG [org.apa.cam.mai.BaseMainSupport] (main)     camel.root=/home/lburgazz/work/apache/dev/camel
2020-02-06 09:57:51,639 DEBUG [org.apa.cam.mai.BaseMainSupport] (main)     camel.context.name=quarkus-camel-example-timer-log-xml
2020-02-06 09:57:51,639 DEBUG [org.apa.cam.mai.BaseMainSupport] (main)     camel.version=3.0.1
2020-02-06 09:57:51,639 DEBUG [org.apa.cam.mai.BaseMainSupport] (main)     camel.quarkus.project.root=/home/lburgazz/work/apache/dev/camel-quarkus
2020-02-06 09:57:51,639 DEBUG [org.apa.cam.mai.BaseMainSupport] (main)     camel.main.xml-routes=file:src/main/resources/routes/my-routes.xml
2020-02-06 09:57:51,641 DEBUG [org.apa.cam.mai.BaseMainSupport] (main) Auto-configuring main from loaded properties: 1
2020-02-06 09:57:51,642 DEBUG [org.apa.cam.mai.BaseMainSupport] (main) Configured property: camel.main.xmlroutes=file:src/main/resources/routes/my-routes.xml on bean: org.apache.camel.main.MainConfigurationProperties@3cd01c0
2020-02-06 09:57:51,643 DEBUG [org.apa.cam.mai.BaseMainSupport] (main) Auto-configuring CamelContext from loaded properties: 1
2020-02-06 09:57:51,644 DEBUG [org.apa.cam.mai.BaseMainSupport] (main) Configured property: camel.context.name=quarkus-camel-example-timer-log-xml on bean: CamelContext(quarkus-camel-example-timer-log-xml)
2020-02-06 09:57:51,645 INFO  [org.apa.cam.mai.BaseMainSupport] (main) Auto-configuration summary:
2020-02-06 09:57:51,645 INFO  [org.apa.cam.mai.BaseMainSupport] (main)  camel.main.xmlroutes=file:src/main/resources/routes/my-routes.xml
2020-02-06 09:57:51,645 INFO  [org.apa.cam.mai.BaseMainSupport] (main)  camel.context.name=quarkus-camel-example-timer-log-xml
2020-02-06 09:57:51,645 DEBUG [org.apa.cam.mai.RoutesConfigurer] (main) RoutesCollectorEnabled: org.apache.camel.quarkus.core.CamelRoutesCollector@314c468
2020-02-06 09:57:51,646 INFO  [org.apa.cam.qua.cor.CamelRoutesCollector] (main) Loading additional Camel XML routes from: file:src/main/resources/routes/my-routes.xml
2020-02-06 09:57:51,648 DEBUG [org.apa.cam.mai.RoutesConfigurer] (main) Adding routes into CamelContext from XML files: file:src/main/resources/routes/my-routes.xml
2020-02-06 09:57:51,648 INFO  [org.apa.cam.qua.cor.FastCamelContext] (main) Apache Camel 3.0.1 (CamelContext: quarkus-camel-example-timer-log-xml) is starting
2020-02-06 09:57:51,648 INFO  [org.apa.cam.imp.eng.DefaultManagementStrategy] (main) JMX is disabled
2020-02-06 09:57:51,650 INFO  [org.apa.cam.qua.cor.FastCamelContext] (main) StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
2020-02-06 09:57:51,650 INFO  [org.apa.cam.qua.cor.FastCamelContext] (main) Route: xml-route started and consuming from: timer://from-xml?period=1s
2020-02-06 09:57:51,650 INFO  [org.apa.cam.qua.cor.FastCamelContext] (main) Total 1 routes, of which 1 are started
2020-02-06 09:57:51,650 INFO  [org.apa.cam.qua.cor.FastCamelContext] (main) Apache Camel 3.0.1 (CamelContext: quarkus-camel-example-timer-log-xml) started in 0.002 seconds
2020-02-06 09:57:51,650 INFO  [io.quarkus] (main) camel-quarkus-examples-timer-log-xml 1.1.0-SNAPSHOT (running on Quarkus 1.2.0.Final) started in 0.021s. 
2020-02-06 09:57:51,650 INFO  [io.quarkus] (main) Profile prod activated. 
2020-02-06 09:57:51,650 INFO  [io.quarkus] (main) Installed features: [camel-core, camel-log, camel-support-common, camel-support-xml, camel-timer, camel-xml, cdi]
2020-02-06 09:57:52,650 INFO  [xml-route] (Camel (camel-1) thread #1 - timer://from-xml) Hello XML!
2020-02-06 09:57:53,650 INFO  [xml-route] (Camel (camel-1) thread #1 - timer://from-xml) Hello XML!
2020-02-06 09:57:54,650 INFO  [xml-route] (Camel (camel-1) thread #1 - timer://from-xml) Hello XML!
2020-02-06 09:57:54,668 INFO  [org.apa.cam.qua.cor.FastCamelContext] (main) Apache Camel 3.0.1 (CamelContext: quarkus-camel-example-timer-log-xml) is shutting down
2020-02-06 09:57:54,668 INFO  [org.apa.cam.mai.MainLifecycleStrategy] (main) CamelContext: quarkus-camel-example-timer-log-xml has been shutdown, triggering shutdown of the JVM.
2020-02-06 09:57:54,669 INFO  [org.apa.cam.qua.cor.FastCamelContext] (main) Apache Camel 3.0.1 (CamelContext: quarkus-camel-example-timer-log-xml) uptime 3.020 seconds
2020-02-06 09:57:54,669 INFO  [org.apa.cam.qua.cor.FastCamelContext] (main) Apache Camel 3.0.1 (CamelContext: quarkus-camel-example-timer-log-xml) is shutdown in 0.001 seconds
2020-02-06 09:57:54,669 INFO  [io.quarkus] (main) camel-quarkus-examples-timer-log-xml stopped in 0.001s

@jstakun
Copy link
Author

jstakun commented Feb 6, 2020

Thanks! This was missing part for me. After adding resources-config.json it works like a charm in both java and native mode.

@jstakun jstakun closed this as completed Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants