Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10384

Shutdown broken when using Spring Boot

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      Camel doesn't shutdown properly in a Spring Boot environment. Calling the /shutdown endpoint causes Camel to hang-up after stopping the CamelContext. The reason for this is the count-down latch in the CamelSpringBootApplicationController. The overriden Main class modifies the latch in the Main class itself, not the one in CamelSpringBootApplicationController. As a result, the latch in CamelSpringBootApplicationController is waiting forever preventing a proper shutdown.

      CamelSpringBootApplicationController .java
          public CamelSpringBootApplicationController(final ApplicationContext applicationContext, final CamelContext camelContext) {
              this.main = new Main() {
                   
                  ...
      
                  @Override
                  protected void doStop() throws Exception {
                      LOG.debug("Controller is shutting down CamelContext");
                      try {
                          super.doStop();
                      } finally {
                          // Should be CamelSpringBootApplicationController.this.latch.countDown();
                          latch.countDown();
                      }
                  }
              };
          }
      

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            amr Artur Markiewicz
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: