Package io.dapr.client.domain
Class ScheduleJobRequest
java.lang.Object
io.dapr.client.domain.ScheduleJobRequest
Represents a request to schedule a job in Dapr.
-
Constructor Summary
ConstructorsConstructorDescriptionScheduleJobRequest(String name, JobSchedule schedule) Constructor to create ScheduleJobRequest.ScheduleJobRequest(String name, Instant dueTime) Constructor to create ScheduleJobRequest. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getData()Gets the data payload of the job.Gets the due time of the job.Gets the failure policy.getName()Gets the name of the job.booleanGets the number of times the job should repeat.Gets the schedule of the job.getTtl()Gets the time-to-live (TTL) or expiration of the job.setData(byte[] data) Sets the data payload for the job.setDueTime(Instant dueTime) Sets the due time when the job should become active or execute once.setFailurePolicy(FailurePolicy failurePolicy) Sets the failure policy for the scheduled job.setOverwrite(boolean overwrite) Sets the overwrite flag.Sets the number of times the job should be triggered.setSchedule(JobSchedule schedule) Sets the schedule for the job.Sets the time-to-live (TTL) or expiration for the job.
-
Constructor Details
-
ScheduleJobRequest
Constructor to create ScheduleJobRequest.- Parameters:
name- of the job.schedule- job has to run.
-
ScheduleJobRequest
Constructor to create ScheduleJobRequest.- Parameters:
name- of the job.dueTime- An optional time at which the job should be active, or the “one shot” time, if other scheduling type fields are not provided. Accepts a “point in time” string in the format of RFC3339, Go duration string (calculated from creation time), or non-repeating ISO8601
-
-
Method Details
-
setData
Sets the data payload for the job. This should be a JSON serialized value or object.- Parameters:
data- The job data in byte array format.- Returns:
- This builder instance.
-
setSchedule
Sets the schedule for the job. The format should follow cron expressions or other supported scheduling formats.- Parameters:
schedule- The job schedule.- Returns:
- This builder instance.
-
setDueTime
Sets the due time when the job should become active or execute once. This can be in RFC3339, Go duration string, or non-repeating ISO8601 format.- Parameters:
dueTime- The due time of the job.- Returns:
- This builder instance.
-
setRepeat
Sets the number of times the job should be triggered. If not set, the job runs indefinitely or until expiration.- Parameters:
repeats- The number of times the job should repeat.- Returns:
- This builder instance.
-
setTtl
Sets the time-to-live (TTL) or expiration for the job. This can be in RFC3339, Go duration string, or non-repeating ISO8601 format.- Parameters:
ttl- The time-to-live for the job.- Returns:
- This builder instance.
-
setFailurePolicy
Sets the failure policy for the scheduled job. This defines how the job should behave in case of failure, such as retrying with a delay or dropping the job entirely.- Parameters:
failurePolicy- theFailurePolicyto apply to the job- Returns:
- this
ScheduleJobRequestinstance for method chaining
-
getName
Gets the name of the job.- Returns:
- The job name.
-
getData
public byte[] getData()Gets the data payload of the job.- Returns:
- The job data as a byte array.
-
getSchedule
Gets the schedule of the job.- Returns:
- The job schedule.
-
getDueTime
Gets the due time of the job.- Returns:
- The due time.
-
getRepeats
Gets the number of times the job should repeat.- Returns:
- The repeat count, or null if not set.
-
getTtl
Gets the time-to-live (TTL) or expiration of the job.- Returns:
- The TTL value.
-
getFailurePolicy
Gets the failure policy.- Returns:
- FailurePolicy.
-
getOverwrite
public boolean getOverwrite() -
setOverwrite
Sets the overwrite flag.- Parameters:
overwrite- The overwrite flag.- Returns:
- This builder instance.
-