スケジュールされたタスク (scheduledtasks)

scheduledtasks エンドポイントは、アプリケーションのスケジュールされたタスクに関する情報を提供します。

スケジュールされたタスクの取得

スケジュールされたタスクを取得するには、次の curl ベースの例に示すように、GET リクエストを /actuator/scheduledtasks に作成します。

$ curl 'http://localhost:8080/actuator/scheduledtasks' -i -X GET

結果のレスポンスは次のようになります。

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 1222

{
  "cron" : [ {
    "runnable" : {
      "target" : "com.example.Processor.processOrders"
    },
    "expression" : "0 0 0/3 1/1 * ?",
    "nextExecution" : {
      "time" : "2025-01-23T11:59:59.999232713Z"
    }
  } ],
  "fixedDelay" : [ {
    "runnable" : {
      "target" : "com.example.Processor.purge"
    },
    "initialDelay" : 0,
    "interval" : 5000,
    "nextExecution" : {
      "time" : "2025-01-23T11:07:09.709795283Z"
    },
    "lastExecution" : {
      "time" : "2025-01-23T11:07:04.705583565Z",
      "status" : "SUCCESS"
    }
  } ],
  "fixedRate" : [ {
    "runnable" : {
      "target" : "com.example.Processor.retrieveIssues"
    },
    "initialDelay" : 10000,
    "interval" : 3000,
    "nextExecution" : {
      "time" : "2025-01-23T11:07:14.696266122Z"
    }
  } ],
  "custom" : [ {
    "runnable" : {
      "target" : "com.example.Processor$CustomTriggeredRunnable@12f40682"
    },
    "trigger" : "com.example.Processor$CustomTrigger@7bd7012d",
    "lastExecution" : {
      "exception" : {
        "message" : "Failed while running custom task",
        "type" : "java.lang.IllegalStateException"
      },
      "time" : "2025-01-23T11:07:04.760648151Z",
      "status" : "ERROR"
    }
  } ]
}

レスポンス構造

レスポンスには、アプリケーションのスケジュールされたタスクの詳細が含まれます。次の表に、レスポンスの構造を示します。

パス タイプ 説明

cron

Array

cron タスク(ある場合)。

cron.[].runnable.target

String

実行されるターゲット。

cron.[].nextExecution.time

String

次回のスケジュール実行の時刻。

cron.[].expression

String

cron 式。

fixedDelay

Array

遅延タスクがある場合は修正されました。

fixedDelay.[].runnable.target

String

実行されるターゲット。

fixedDelay.[].initialDelay

Number

最初の実行までの遅延(ミリ秒単位)。

fixedDelay.[].nextExecution.time

String

次にスケジュールされている実行の時刻(わかっている場合)。

fixedDelay.[].interval

Number

最後の実行の終了から次の実行の開始までの間隔(ミリ秒単位)。

fixedRate

Array

固定レートタスク(ある場合)。

fixedRate.[].runnable.target

String

実行されるターゲット。

fixedRate.[].interval

Number

各実行の開始間の間隔(ミリ秒単位)。

fixedRate.[].initialDelay

Number

最初の実行までの遅延(ミリ秒単位)。

fixedRate.[].nextExecution.time

String

次にスケジュールされている実行の時刻(わかっている場合)。

custom

Array

カスタムトリガーがある場合は、タスク。

custom.[].runnable.target

String

実行されるターゲット。

custom.[].trigger

String

タスクのトリガー。

*.[].lastExecution

Object

このタスクの最後の実行(ある場合)。

*.[].lastExecution.status

String

最後の実行のステータス (STARTED、SUCCESS、ERROR)。

*.[].lastExecution.time

String

最後の実行時刻。

*.[].lastExecution.exception.type

String

タスクによってスローされた例外の種類(存在する場合)。

*.[].lastExecution.exception.message

String

タスクによってスローされた例外のメッセージ(存在する場合)。