import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import javax.annotation.PreDestroy;
+
@SpringBootApplication
@Slf4j
endlessConsumer.start();
}
+ @PreDestroy
+ public void shutdown()
+ {
+ try
+ {
+ log.info("Stopping EndlessConsumer");
+ endlessConsumer.stop();
+ }
+ catch (IllegalStateException e)
+ {
+ log.info("Was already stopped: {}", e.toString());
+ }
+ catch (Exception e)
+ {
+ log.error("Unexpected exception while stopping EndlessConsumer: {}", e);
+ }
+ }
+
public static void main(String[] args)
{