Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

It will output to log the progress during graceful shutdown as shown in an example below

...

Notice how it waits while there are inflight exchanges still being processed before it can shutdown.

...

If you do not want to see these logs, you can suppress this by setting the option SuppressLoggingOnTimeout to true.

...

...

Notice the suppress is a "best effort" though there may still be some logs coming from 3rd party libraries and whatnot, which Camel cannot control.

...

If you enable DEBUG logging level on org.apache.camel.impl.DefaultShutdownStrategy then it logs the same inflight exchange information during graceful shutdown

...

...

If you do not want to see these logs, you can turn this off by setting the option logInflightExchangesOnTimeout to false.

...

...

Controlling ordering of routes

...

A Java DSL based example to defer shutting down the 2nd route:

...

{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownDeferTest.java}

...

The same route in Spring XML would be:

...

{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ShutdownDeferTest.xml}

...

...

Its best to only defer shutting down internal routes only. As public routes should shutdown as quickly as possible otherwise it will just keep intake new messages which will delay the shutdown processor. Or even have it timeout if a lot of new messages keep coming in.

ShutdownRunningTask

This option control how a given route consumer acts during shutdown. Most route consumer will only operate on a single task (message), however the Batch Consumer can operate on many messages (in a batch). This option is for those kind of consumers. By default it uses the option CompleteCurrentTaskOnly which mean that the current in progress task (message) will be completed and then the consumer will shutdown. The other option CompleteAllTasks allows the consumer to complete all the tasks (messages) before shutting down. For example a File consumer will process all the pending files it has picked up before shutting down.

A Java DSL based example to complete all messages during shutting down the first route:

...

{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ShutdownCompleteAllTasksTest.java}

...

The same route in Spring XML would be:

...

{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ShutdownCompleteAllTasksTest.xml}

JMX managed

The ShutdownStrategy is JMX aware as well so you can manage it from a JMX console. For example you can change the timeout value.

...