Object - task : Scheduler

Represents a ballerina task.

attach

(service serviceToAttach, any attachment)

returns SchedulerError?

Attaches the provided service to the task.

Parameters

  • serviceToAttach service
  • Service which needs to be attached to the task.

  • attachment any - ()
  • An optional parameter which needs to passed inside the resources.

  • Return Type

    (SchedulerError?)
  • Returns SchedulerError if the process failed due to any reason, nil otherwise.

detach

(service attachedService)

returns SchedulerError?

Detach the provided service from the task.

Parameters

  • attachedService service
  • service which needs to be detached from the task.

  • Return Type

    (SchedulerError?)
  • Returns SchedulerError if the process failed due to any reason, nil otherwise.

start

()

returns SchedulerError?

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

  • Return Type

    (SchedulerError?)
  • Returns SchedulerError if the process failed due to any reason, nil otherwise.

stop

()

returns SchedulerError?

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

  • Return Type

    (SchedulerError?)
  • Returns SchedulerError if the process failed due to any reason, nil otherwise.

pause

()

returns SchedulerError?

Pauses the task.

  • Return Type

    (SchedulerError?)
  • Returns SchedulerError if an error is occurred while resuming, nil Otherwise.

resume

()

returns SchedulerError?

Resumes a paused task.

  • Return Type

    (SchedulerError?)
  • Returns SchedulerError when an error occurred while pausing, nil Otherwise.

isStarted

()

returns boolean

Checks whether the task is started or not.

  • Return Type

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