Listener -
task
: Listener
Represents a ballerina task listener, which can be used to schedule and execute tasks periodically.
Constructor
__init
(TimerConfiguration | AppointmentConfiguration configuration)
- configuration TimerConfiguration | AppointmentConfiguration
-
The
task:TimerConfiguration
ortask:AppointmentConfiguration
record to define thetask:Listener
behavior
Methods
Detaches the given service
from the task:Listener
.
Stops the task:Listener
and the attached services gracefully.
Stops the task:Listener
and the attached services immediately.
Pauses the task:Listener
and the attached services.
Resumes a paused task:Listener
.
LifeCycle Methods
Methods
Detaches the given service
from the task:Listener
.
Parameters
- s service
-
Service to be detached from the listener
-
Return Type
(error?) () or else a
task:ListenerError
upon failure to detach the service
Stops the task:Listener
and the attached services gracefully. It will wait if there are any tasks still to be
completed. This may panic if the stopping causes any error.
-
Return Type
(error?) () or else a
task:ListenerError
upon failure to stop the listener
Stops the task:Listener
and the attached services immediately. This will cancel any ongoing tasks. This may
panic if the stopping causes any error.
-
Return Type
(error?) () or else a
task:ListenerError
upon failure to stop the listener
Pauses the task:Listener
and the attached services.
-
Return Type
(ListenerError?) A
task:ListenerError
if an error occurred while pausing or else ()
Resumes a paused task:Listener
. Calling this on an already-running task:Listener
will not cause any error.
-
Return Type
(ListenerError?) A
task:ListenerError
if an error occurred while resuming or else ()
LifeCycle Methods
Attaches the given service
to the task:Listener
. This may panic if the service attachment is fails.
Parameters
- s service
-
Service to attach to the listener
- name string? (default ())
-
Name of the service
-
Return Type
(error?) () or else a
task:ListenerError
upon failure to attach the service