Class - task : Scheduler

Represents a ballerina task Scheduler, which can be used to run jobs periodically, using the given configurations.

Methods

Attaches the provided service to the task.

Detaches the provided service from the task.

Starts running the task.

Stops the task.

Pauses the task.

Resumes a paused task.

Checks whether the task listener is started or not.

attach

(service serviceToAttach, any... attachments)

returns SchedulerError?
Isolated Function

Attaches the provided service to the task.

Parameters

  • serviceToAttach service
  • Ballerina service object, which needs to be attached to the task

  • attachments any...
  • Set of optional parameters, which need to be passed inside the resources

  • Return Type

    (SchedulerError?)
  • A task:SchedulerError if the process failed due to any reason or else ()

detach

(service attachedService)

returns SchedulerError?
Isolated Function

Detaches the provided service from the task.

Parameters

  • attachedService service
  • Ballerina service object, which needs to be detached from the task

  • Return Type

    (SchedulerError?)
  • A task:SchedulerError if the process failed due to any reason or else ()

start

()

returns SchedulerError?
Isolated Function

Starts running the task. Task Scheduler will not run until this has been called.

  • Return Type

    (SchedulerError?)
  • A task:SchedulerError if the process failed due to any reason or else ()

stop

()

returns SchedulerError?
Isolated Function

Stops the task. This will stop after running the existing jobs.

  • Return Type

    (SchedulerError?)
  • A task:SchedulerError if the process failed due to any reason or else ()

pause

()

returns SchedulerError?
Isolated Function

Pauses the task.

  • Return Type

    (SchedulerError?)
  • A task:SchedulerError if an error is occurred while pausing or else ()

resume

()

returns SchedulerError?
Isolated Function

Resumes a paused task.

  • Return Type

    (SchedulerError?)
  • A task:SchedulerError when an error occurred while resuming or else ()

isStarted

()

returns boolean
Isolated Function

Checks whether the task listener is started or not.

  • Return Type

    (boolean)
  • true if the Scheduler is already started or else false if the Scheduler is not started yet or stopped calling the Scheduler.stop() function