Class Carrot
- java.lang.Object
-
- cn.boboweike.carrot.configuration.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 onBackgroundTaskto 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();
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CarrotConfigurationconfigure()static CarrotConfigurationdestroy()static BackgroundTaskServergetBackgroundTaskServer()
-
-
-
Method Detail
-
configure
public static CarrotConfiguration configure()
-
destroy
public static CarrotConfiguration destroy()
-
getBackgroundTaskServer
public static BackgroundTaskServer getBackgroundTaskServer()
-
-