Annotation Interface Recurring


@Target(METHOD) @Retention(RUNTIME) @Executable(processOnStartup=true) @Inherited @Documented public @interface Recurring
Allows to recurrently schedule a method from a Micronaut Service bean using JobRunr. Note that methods annotated with the @Recurring annotation may only have zero parameters or a single parameter of type org.jobrunr.jobs.context.JobContext.
An example:
      public class MyService {

          @Recurring(id = "my-recurring-job", cron = "**/5 * * * *")
          @Job(name = "Doing some work")
          public void doWork() {
              // some long running task
          }
      }
 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The cron expression defining when to run this recurring job.
     
    The time interval between scheduled runs of this recurring job.
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    A special cron / interval expression value that indicates a disabled trigger: "-".
  • Field Details

    • RECURRING_JOB_DISABLED

      static final String RECURRING_JOB_DISABLED
      A special cron / interval expression value that indicates a disabled trigger: "-".

      This is primarily meant for use with ${...} placeholders, allowing for external disabling of corresponding recurring methods.

      This mechanism was borrowed from @Scheduled in Spring Framework.

      See Also:
  • Element Details

    • id

      String id
      Returns:
      The id of this recurring job which can be used to alter or delete it.
      Default:
      ""
    • cron

      String cron
      The cron expression defining when to run this recurring job.

      The special value "-" indicates a disabled cron trigger, primarily meant for externally specified values resolved by a ${...} placeholder.

      Returns:
      An expression that can be parsed to a cron schedule.
      Default:
      ""
    • interval

      String interval
      The time interval between scheduled runs of this recurring job.

      @see Duration

      Examples:

       "PT20S"     -- 20 seconds
       "PT15M"     -- 15 minutes
       "PT10H"     -- 10 hours
       "P2D"       -- 2 days
       "P2DT3H4M"  -- 2 days, 3 hours and 4 minutes
       
      Default:
      ""
    • zoneId

      String zoneId
      Returns:
      The zoneId (timezone) of when to run this recurring job.
      Default:
      ""