Class BackgroundJobService


  • public class BackgroundJobService
    extends Object
    The service that allows to add new background tasks.
    Since:
    8.1.0
    • Method Detail

      • addJob

        public Long addJob​(Class<?> processorClass,
                           Map<String,​Object> parameters,
                           String description,
                           Instant runAt)
        Adds a new background job.
        Parameters:
        processorClass - processor's class
        parameters - job parameters
        runAt - desired execution time (or Instant.now if it has to be run immediately)
        Returns:
        job id
      • processNextJobs

        @Internal
        public int processNextJobs()
        Process a next portion of active jobs.
        Returns:
      • registerBackgroundJobProcessor

        public void registerBackgroundJobProcessor​(BackgroundJobProcessor backgroundJobProcessor)
        Registers a background processor.
        Parameters:
        backgroundJobProcessor -
      • unregisterBackgroundJobProcessor

        public void unregisterBackgroundJobProcessor​(BackgroundJobProcessor backgroundJobProcessor)
        Unregisters a background processor.
        Parameters:
        backgroundJobProcessor -