Class MainSupport

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.main.BaseMainSupport
org.apache.camel.main.MainSupport
Direct Known Subclasses:
MainCommandLineSupport

public abstract class MainSupport extends BaseMainSupport
Class for main implementations to allow starting up a JVM with Camel embedded.
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
    • UNINITIALIZED_EXIT_CODE

      protected static final int UNINITIALIZED_EXIT_CODE
      See Also:
    • DEFAULT_EXIT_CODE

      protected static final int DEFAULT_EXIT_CODE
      See Also:
    • exitCode

      protected final AtomicInteger exitCode
    • shutdownStrategy

      protected MainShutdownStrategy shutdownStrategy
    • camelTemplate

      protected volatile org.apache.camel.ProducerTemplate camelTemplate
  • Constructor Details

    • MainSupport

      @SafeVarargs protected MainSupport(Class<? extends org.apache.camel.CamelConfiguration>... configurationClasses)
    • MainSupport

      protected MainSupport()
  • Method Details

    • doInit

      protected void doInit() throws Exception
      Overrides:
      doInit in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • autoconfigure

      protected void autoconfigure(org.apache.camel.CamelContext camelContext) throws Exception
      Overrides:
      autoconfigure in class BaseMainSupport
      Throws:
      Exception
    • run

      public void run() throws Exception
      Runs this process with the given arguments, and will wait until completed, or the JVM terminates.
      Throws:
      Exception
    • beforeStart

      protected void beforeStart() throws Exception
      Callback to run custom logic before CamelContext is being started.

      It is recommended to use MainListener instead.

      Throws:
      Exception
    • afterStart

      protected void afterStart() throws Exception
      Callback to run custom logic after CamelContext has been started.

      It is recommended to use MainListener instead.

      Throws:
      Exception
    • internalBeforeStart

      protected void internalBeforeStart()
      Tasks to run before start() is called.
    • beforeStop

      protected void beforeStop() throws Exception
      Callback to run custom logic before CamelContext is being stopped.

      It is recommended to use MainListener instead.

      Throws:
      Exception
    • afterStop

      protected void afterStop() throws Exception
      Callback to run custom logic after CamelContext has been stopped.

      It is recommended to use MainListener instead.

      Throws:
      Exception
    • completed

      public void completed()
      Marks this process as being completed.
    • getCompleteTask

      public Runnable getCompleteTask()
      Gets the complete task which allows to trigger this on demand.
    • registerMainBootstrap

      protected void registerMainBootstrap()
      Registers MainBootstrapCloseable with the CamelContext.
    • getExitCode

      public int getExitCode()
    • isTrace

      public boolean isTrace()
    • enableTrace

      public void enableTrace()
    • enableTraceStandby

      public void enableTraceStandby()
    • getShutdownStrategy

      public MainShutdownStrategy getShutdownStrategy()
    • setShutdownStrategy

      public void setShutdownStrategy(MainShutdownStrategy shutdownStrategy)
      Set the MainShutdownStrategy used to properly shut-down the main instance. By default a DefaultMainShutdownStrategy will be used.
      Parameters:
      shutdownStrategy - the shutdown strategy
    • getAppName

      public String getAppName()
    • setAppName

      public void setAppName(String appName)
      Application name (used for logging start and stop)
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • configureLifecycle

      protected void configureLifecycle(org.apache.camel.CamelContext camelContext) throws Exception
      Overrides:
      configureLifecycle in class BaseMainSupport
      Throws:
      Exception
    • waitUntilCompleted

      protected void waitUntilCompleted()
    • findOrCreateCamelTemplate

      protected abstract org.apache.camel.ProducerTemplate findOrCreateCamelTemplate()
    • createCamelContext

      protected abstract org.apache.camel.CamelContext createCamelContext()
    • getCamelTemplate

      public org.apache.camel.ProducerTemplate getCamelTemplate() throws Exception
      Throws:
      Exception
    • initCamelContext

      protected void initCamelContext() throws Exception
      Throws:
      Exception