Share via


TimerTrigger インターフェイス

public interface TimerTrigger

TimerTrigger(name = "keepAliveTrigger", schedule = "0 */5 * * * *") String timerInfo, ExecutionContext context ) { // timeInfo は JSON 文字列です。お気に入りの JSON ライブラリ context.getLogger().info("Timer is triggered: " + timerInfo); }

メソッドの概要

修飾子と型 メソッドと説明
String dataType()

Functions ランタイムがパラメーター値をどのように扱うかを定義します。 次のいずれかの値になります。

    <li>
    
      <p>"": get the value as a string, and try to deserialize to actual parameter type like POJO </p>
    
    </li>
    
    <li>
    
      <p>string: always get the value as a string </p>
    
    </li>
    
    <li>
    
      <p>binary: get the value as a binary data, and try to deserialize to actual parameter type byte[] </p>
    
    </li>
    

String name()

関数コード内のタイマー オブジェクトを表す変数の名前。

String schedule()

{minute} {hour} {day} {month} {day-of-week} 形式CRON 式

</code> .</p>

<caption>A table showing some examples of CRON expressions that could be used.</caption>

<row>

  <entry thead="yes">

    <p>Goal </p>

  </entry>

  <entry thead="yes">

    <p>CRON Expression  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger once every five minutes: </p>

  </entry>

  <entry thead="no">

    <p>0 *&amp;#47;5 * * * *  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger once at the top of every hour: </p>

  </entry>

  <entry thead="no">

    <p>0 0 * * * *  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger once every two hours: </p>

  </entry>

  <entry thead="no">

    <p>0 0 *&amp;#47;2 * * *  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger once every hour from 9 AM to 5 PM: </p>

  </entry>

  <entry thead="no">

    <p>0 0 9-17 * * *  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger at 9:30 AM every day: </p>

  </entry>

  <entry thead="no">

    <p>0 30 9 * * *  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger at 9:30 AM every weekday: </p>

  </entry>

  <entry thead="no">

    <p>0 30 9 * * 1-5  </p>

  </entry>

</row>

メソッドの詳細

dataType

public String dataType() default ""

Functions ランタイムがパラメーター値をどのように扱うかを定義します。 次のいずれかの値になります。

    <li>
    
      <p>"": get the value as a string, and try to deserialize to actual parameter type like POJO </p>
    
    </li>
    
    <li>
    
      <p>string: always get the value as a string </p>
    
    </li>
    
    <li>
    
      <p>binary: get the value as a binary data, and try to deserialize to actual parameter type byte[] </p>
    
    </li>
    

Returns:

Functions ランタイムによって使用される dataType。

name

public String name()

関数コード内のタイマー オブジェクトを表す変数の名前。

Returns:

関数コード内のタイマー オブジェクトを表す変数の名前。

schedule

public String schedule()

{minute} {hour} {day} {month} {day-of-week} 形式CRON 式

</code> .</p>

<caption>A table showing some examples of CRON expressions that could be used.</caption>

<row>

  <entry thead="yes">

    <p>Goal </p>

  </entry>

  <entry thead="yes">

    <p>CRON Expression  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger once every five minutes: </p>

  </entry>

  <entry thead="no">

    <p>0 *&amp;#47;5 * * * *  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger once at the top of every hour: </p>

  </entry>

  <entry thead="no">

    <p>0 0 * * * *  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger once every two hours: </p>

  </entry>

  <entry thead="no">

    <p>0 0 *&amp;#47;2 * * *  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger once every hour from 9 AM to 5 PM: </p>

  </entry>

  <entry thead="no">

    <p>0 0 9-17 * * *  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger at 9:30 AM every day: </p>

  </entry>

  <entry thead="no">

    <p>0 30 9 * * *  </p>

  </entry>

</row>

<row>

  <entry thead="no">

    <p>To trigger at 9:30 AM every weekday: </p>

  </entry>

  <entry thead="no">

    <p>0 30 9 * * 1-5  </p>

  </entry>

</row>

Returns:

実行する関数をスケジュールするために使用される CRON 式を表す文字列。

適用対象