Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
package com.example;
 
... // imports

public class MyFatWarInitializer extends FatWarInitializer {


  @Override
  protected Class<? extends FatJarRouter> routerClass() {
    return MyFatJarRouter.class;
  }

}

Blocking main thread

Camel applications extending FatJarRouter by default blocks the main thread of the application. It means that after you start your fat jar, your application waits for Ctrl+C signal and doesn't exit immediately. If you would like to achieve similar behavior for non-FatJarRouter applications, retrieve CamelSpringBootApplicationController bean from your ApplicationContext and use the former to block the main thread of your application using CamelSpringBootApplicationController#blockMainThread() method.

Code Block
languagejava
public static void main(String... args) {
    ApplicationContext applicationContext = new SpringApplication(MyCamelApplication.class).run(args);
    CamelSpringBootApplicationController applicationController =
            applicationContext.getBean(CamelSpringBootApplicationController.class);
    applicationController.blockMainThread();
}


Include Page
Endpoint See Also
Endpoint See Also