Class Carrot


  • public class Carrot
    extends Object
    This class provides the entry point for the Carrot configuration. This is needed when you want to use the static methods on BackgroundTask to enqueue and schedule tasks. It also allows to startup the Dashboard which will be available on port 8000.

    An example:

          Carrot.configure()
                     .useTaskActivator(taskActivator)
                     .useTaskStorageProvider(taskStorageProvider)
                     .useBackgroundTaskServer()
                     .useJmxExtensions()
                     .useDashboard()
                     .initialize();
     

    Both the backgroundTaskServer and the dashboard fluent API allows to be enabled or disabled using ENV variables which is handy in docker containers.

    An example:

         boolean isBackgroundTaskServerEnabled = true; // or get it via ENV variables
         boolean isDashboardEnabled = true; // or get it via ENV variables
         Carrot.configure()
                     .useTaskStorageProvider(taskStorageProvider)
                     .useTaskActivator(taskActivator)
                     .useBackgroundTaskServerIf(isBackgroundTaskServerEnabled)
                     .useDashboardIf(isDashboardEnabled)
                     .useJmxExtensions()
                     .initialize();