Class TriggerResource
java.lang.Object
org.sterl.spring.persistent_tasks.trigger.api.TriggerResource
@RestController
@RequestMapping("${spring.persistent-tasks.web.base-path:spring-tasks-api}")
public class TriggerResource
extends Object
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncancelTrigger(String taskName, String id) longcount()org.springframework.data.web.PagedModel<Trigger> list(TriggerSearch search, org.springframework.data.domain.Pageable pageable) Lists all registered cron triggers (scheduled triggers).org.springframework.data.web.PagedModel<TriggerGroup> listGrouped(TriggerSearch search, org.springframework.data.domain.Pageable pageable) booleanresumeCron(String taskName, String id) Resumes a suspended cron trigger, allowing new trigger instances to be created.setRunAt(String taskName, String id, OffsetDateTime runAt) booleansuspendCron(String taskName, String id) Suspends a cron trigger, preventing new trigger instances from being created.
-
Field Details
-
PATH_GROUPED
- See Also:
-
-
Constructor Details
-
TriggerResource
public TriggerResource()
-
-
Method Details
-
count
@GetMapping("triggers/count") public long count() -
listGrouped
@GetMapping("triggers-grouped") public org.springframework.data.web.PagedModel<TriggerGroup> listGrouped(TriggerSearch search, @PageableDefault(size=100) org.springframework.data.domain.Pageable pageable) -
list
@GetMapping("triggers") public org.springframework.data.web.PagedModel<Trigger> list(TriggerSearch search, @PageableDefault(size=100,direction=ASC,sort="data.runAt") org.springframework.data.domain.Pageable pageable) -
setRunAt
@PostMapping("triggers/{taskName}/{id}/run-at") public Optional<Trigger> setRunAt(@PathVariable("taskName") String taskName, @PathVariable("id") String id, @RequestBody OffsetDateTime runAt) -
cancelTrigger
-
listCronTriggerInfos
Lists all registered cron triggers (scheduled triggers).- Returns:
- list of all cron trigger definitions
-
suspendCron
@DeleteMapping("cron-triggers/{taskName}/{id}") public boolean suspendCron(@PathVariable("taskName") String taskName, @PathVariable("id") String id) Suspends a cron trigger, preventing new trigger instances from being created.- Parameters:
id- the cron trigger ID to suspend- Returns:
trueif found, otherweisefalse
-
resumeCron
@PostMapping("cron-triggers/{taskName}/{id}") public boolean resumeCron(@PathVariable("taskName") String taskName, @PathVariable("id") String id) Resumes a suspended cron trigger, allowing new trigger instances to be created.- Parameters:
id- the cron trigger ID to resume- Returns:
trueif found, otherweisefalse
-