Class ScheduleJobRequest

java.lang.Object
io.dapr.client.domain.ScheduleJobRequest

public class ScheduleJobRequest extends Object
Represents a request to schedule a job in Dapr.
  • Constructor Details

    • ScheduleJobRequest

      public ScheduleJobRequest(String name, JobSchedule schedule)
      Constructor to create ScheduleJobRequest.
      Parameters:
      name - of the job.
      schedule - job has to run.
    • ScheduleJobRequest

      public ScheduleJobRequest(String name, Instant dueTime)
      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

      public ScheduleJobRequest setData(byte[] data)
      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

      public ScheduleJobRequest setSchedule(JobSchedule schedule)
      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

      public ScheduleJobRequest setDueTime(Instant dueTime)
      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

      public ScheduleJobRequest setRepeat(Integer repeats)
      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

      public ScheduleJobRequest setTtl(Instant ttl)
      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

      public ScheduleJobRequest setFailurePolicy(FailurePolicy failurePolicy)
      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 - the FailurePolicy to apply to the job
      Returns:
      this ScheduleJobRequest instance for method chaining
    • getName

      public String 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

      public JobSchedule getSchedule()
      Gets the schedule of the job.
      Returns:
      The job schedule.
    • getDueTime

      public Instant getDueTime()
      Gets the due time of the job.
      Returns:
      The due time.
    • getRepeats

      public Integer getRepeats()
      Gets the number of times the job should repeat.
      Returns:
      The repeat count, or null if not set.
    • getTtl

      public Instant getTtl()
      Gets the time-to-live (TTL) or expiration of the job.
      Returns:
      The TTL value.
    • getFailurePolicy

      public FailurePolicy getFailurePolicy()
      Gets the failure policy.
      Returns:
      FailurePolicy.
    • getOverwrite

      public boolean getOverwrite()
    • setOverwrite

      public ScheduleJobRequest setOverwrite(boolean overwrite)
      Sets the overwrite flag.
      Parameters:
      overwrite - The overwrite flag.
      Returns:
      This builder instance.