public class Appointment extends AbstractTask
id
Constructor and Description |
---|
Appointment(String cronExpression)
Creates an Appointment object with provided cron expression.
|
Appointment(String cronExpression,
long maxRuns)
Creates an Appointment object with provided cron expression,
which will stop after running provided number of times.
|
Modifier and Type | Method and Description |
---|---|
String |
getCronExpression()
Returns the cron expression for this Appointment.
|
long |
getMaxRuns()
Gets the number of maximum runs of this Appointment.
|
void |
start(Context context)
Run all the services attached to the task.
|
addService, getId, getService, getServicesMap, pause, removeService, resume, stop
public Appointment(String cronExpression) throws SchedulingException
cronExpression
- Cron expression for which the Appointment triggers.SchedulingException
- When initializing this Appointment is failed.public Appointment(String cronExpression, long maxRuns) throws SchedulingException
cronExpression
- Cron expression for which the Appointment triggers.maxRuns
- Number of times after which the Appointment will cancel.SchedulingException
- When initializing this Appointment is failed.public String getCronExpression()
public long getMaxRuns()
public void start(Context context) throws SchedulingException
context
- Ballerina context which runs the services.SchedulingException
- When there is a failure to stop the task after maximum number of runs specified.Copyright © 2019 WSO2. All rights reserved.