camel-quarkus icon indicating copy to clipboard operation
camel-quarkus copied to clipboard

Camel debug is not working

Open apupier opened this issue 1 year ago • 3 comments

Bug description

  • jbang '-Dcamel.jbang.version=4.6.0' camel@apache/camel init 'Demo.java'
  • jbang '-Dcamel.jbang.version=4.6.0' camel@apache/camel export --runtime=quarkus --gav=com.acme:myproject:1.0-SNAPSHOT
  • mvn quarkus:dev -Pcamel.debug
  • Connect with jconsole
  • Go to the Route MBean operations and call suspend
  • it i logged INFO [org.apa.cam.imp.eng.AbstractCamelContext] (RMI TCP Connection(10)-127.0.0.1) Suspended route1 (timer://java) but the route is still executed

I tried also with camel.jbang.version 4.7.0-SNAPSHOT which is genrating project with Camel Quarkus 3.12.0

apupier avatar Jul 05 '24 09:07 apupier

Something similar was mentioned elsewhere recently.

It is likely related to CQ configuring NoShutdownStrategy in dev mode. It prohibits route suspension.

You can suppress it by setting a property like camel.main.shutdownTimeout=30.

jamesnetherton avatar Jul 05 '24 10:07 jamesnetherton

calling mvn quarkus:dev -Pcamel.debug -Dcamel.main.shutdownTimeout=30 is effectively working. Thanks for the workaround.

What is the purpose of this NoShutdownStrategy in dev mode? And why would it prevent to suspend/stop routes?

Would it be possible to modify this strategy when the camel-quarkus-debug depdency is on the classpath?

apupier avatar Jul 05 '24 12:07 apupier

What is the purpose of this NoShutdownStrategy in dev mode?

I think the original intent was that if you're running in dev mode, you're probably looking to iterate quickly. I.e you don't want hot reloading to take a long time due to waiting for inflight messages to complete etc.

And why would it prevent to suspend/stop routes?

Because it's effectively a noop implementation of ShutdownStrategy.

Would it be possible to modify this strategy when the camel-quarkus-debug depdency is on the classpath?

Yes, that should be possible. Or alternatively, we could implement suspend logic in NoShutdownStrategy (maybe by delegating to DefaultShutdownStrategy).

jamesnetherton avatar Jul 05 '24 12:07 jamesnetherton