Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. void onStart(@Observes StartupEvent ev, CamelRuntime rt) {
  2. runtime = new FastApplicationRuntime(rt.getRegistry());
  3. runtime.setProperties(RuntimeSupport.loadProperties());
  4. runtime.addListeners(ServiceLoader.load(Runtime.Listener.class));
  5.  
  6. new Thread(() -> {
  7. try {
  8. LOGGER.info("Starting Camel Runtime");
  9. runtime.run(false);
  10. } catch (Exception e) {
  11. throw new RuntimeException(e);
  12. }
  13. }).start();
  14. }
  15.  
  16. void onStop(@Observes ShutdownEvent ev) {
  17. if (runtime != null) {
  18. try {
  19. LOGGER.info("Stopping Camel Runtime");
  20. runtime.stop();
  21. LOGGER.info("Camel Runtime stopped");
  22. } catch (Exception e) {
  23. throw new RuntimeException(e);
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement