Batch Status

STARTING
STARTED
STOPPING
STOPPED
FAILED
COMPLETED
ABANDONED

Chunk

<step id="stepC" next="stepD">

  <properties> ... </properties>
  <listeners>
    <!--
      Implements these interface :
      StepListener,
      ItemReadListener,ItemProcessListener,ItemWriteListener,
      ChunkListener,
      RetryReadListener,RetryProcessListener,RetryWriteListener,
      SkipReadListener,SkipProcessListener,SkipWriteListener
    -->
    <listener ref="MyItemReadListenerImpl"/>
    ...
  </listeners>

  <chunk checkpoint-policy="item" item-count="5" time-limit="180"
         buffer-items="true" skip-limit="10" retry-limit="3">
    <!--
      checkpoint-policy
        "item"   : (default) "item-count" 回ごとに JEEのトランザクションをコミット
        "custom" : コミットのタイミングは "checkpoint-algorithm" で指定
      item-count
      time-limit 秒数
      buffer-items
        "true"   : (default) "item-count" 回分のreader, processor の処理結果を保持
        しておく。writer は、"item-count" 回に一度呼ばれる。
      skip-limit
        default ∞ : skippable-exception が何回発生したらエラーにするか
      retry-limit
        default ∞ : retryable-exception が何回発生したらエラーにするか
    -->

    <reader ref="pkg.MyItemReaderImpl"></reader>
    <processor ref="pkg.MyItemProcessorImpl"></processor>
    <writer ref="pkg.MyItemWriterImpl"></writer>
    
    <!-- Implements CheckpointAlgorightm interface -->
    <checkpoint-algorithm>pkg.MyCheckpointAlgorithm</checkpoint-algorithm>
    
    <skippable-exception-classes>
      <include class="pkg.MyItemException"/>
      <exclude class="pkg.MyItemSeriousSubException"/>
    </skippable-exception-classes>
    
    <retryable-exception-classes>
      <include class="pkg.MyResourceTempUnavailable"/>
    </retryable-exception-classes>
    
    <no-rollback-exception-classes>
      <include class="pkg.MyResourceTempUnavailable"/>
    </no-rollback-exception-classes>
  </chunk>
  
  <!-- データを分割すれば、chunk を並列に動かせる場合に
  定義する -->
  <partition>
    <!-- JSL(Job Specification Language) 記述時にデータを分割
    できるときは plan を記述。mapper と排他利用 --> 
    <plan partitions="2" threads="2">
      <properties partition="0">
        <property name="firstItem" value="0"/>
        <property name="lastItem" value="500"/>
      </properties>
      <properties partition="1">
        <property name="firstItem" value="501"/>
        <property name="lastItem" value="999"/>
      </properties>
    </plan>
    
    <!-- 実行時にデータを分割するときには、mapperで行う
    implements PartitionMapper -->
    <mapper ref="MyPartitionMapperImpl"/>
    
    <!-- 並行して実行した結果を結合する
    implements PartitionReducer -->
    <reducer ref="MyPartitionReducerImpl"/>
    
    <!-- plan 一つ分の処理結果(chunk実行結果)を収集して analyzer に渡す
    implements PartitionCollector -->
    <collector ref="MyPartitionCollectorImpl"/>
    
    <!-- plan 一つ分の処理結果(chunk実行結果)の後処理を行う
    implements PartitionCollector -->
    <analyzer ref="MyPartitionAnalyzerImpl"/>
  </partition>
  
  <!-- on="xxx" は、Writer で @Inject した StepContext に設定
  StepContext#setExitStatus(str) -->
  <!-- バッチステータスを COMPLETED にする
       on : Chunkの指定した終了ステータスのパターン。*(0 or more any chars),?(1 some char)
       exit-status : 任意の文字列。省略時には、Chunkの指定した終了ステータス
  -->
  <end on="COMPLETED" exit-status="MY_COMPLETED_EXIT_STATUS"/>

  <!-- バッチステータスを STOPPED にする
       on : Chunkの指定した終了ステータスのパターン。*(0 or more any chars),?(1 some char)
       exit-status : 任意の文字列。省略時には、Chunkの指定した終了ステータス
       restart : the id of step, flow, split, decision
  -->
  <stop on="MY_TEMP_ISSUE_EXIST_STATUS" restart="step0"/>

  <!-- バッチステータスを FAILED にする
       on : Chunkの指定した終了ステータスのパターン。*(0 or more any chars),?(1 some char)
       exit-status : 任意の文字列。省略時には、Chunkの指定した終了ステータス
  -->
  <fail on="MY_ERROR_EXIT_STATUS" exit-status="MY_ERROR_EXIT_STATUS"/>

  <!-- 完了ステータスをもとに、次の Step,Flow,Split,Decision Element を実行する
       on : Chunkの指定した終了ステータスのパターン。*(0 or more any chars),?(1 some char)
       to : the id of step, flow, split, decision
  -->
  <next on="I'VE BEEN WORKING ON THE RAILROAD" to="step1"/>
</step>

Batchlet

<step id="stepD" next="stepE">
  <batchlet ref="pkg.MyBatchletImpl">
    <properties>
      <property name="pname" value="pvalue"/>
    </properties>
  </batchlet>
  
  <!-- on="xxx" は、Batchlet#Process の返値 -->
  <end on="COMPLETED" exit-status="MY_COMPLETED_EXIT_STATUS"/>
  <stop on="MY_TEMP_ISSUE_EXIST_STATUS" restart="step0"/>
  <fail on="MY_ERROR_EXIT_STATUS" exit-status="MY_ERROR_EXIT_STATUS"/>
  <next on="I'VE BEEN WORKING ON THE RAILROAD"/>
</step>

Flow

逐次実行の塊

<flow id="flowA" next="stepE">
  <step id="flowAstepA" next="flowAstepB">...</step>
  <step id="flowAstepB" next="flowAflowC">...</step>
  <flow id="flowAflowC" next="flowAsplitD">...</flow>
  <split id="flowAsplitD" next="flowAstepE">...</split>
  <step id="flowAstepE">...</step>
</flow>

最後の step は next を持てない。flow の next に遷移するため

Split

並列実行の塊

<split id="splitA" next="stepB">
  <flow id="splitAflowA">...</flow>
  <flow id="splitAflowB">...</flow>
  <flow id="splitAflowC">...</flow>
</split>

Decision Element

<!-- Implemnts Decider -->
<decision id="decisionA" ref="MyDeciderImpl">
  <fail on="FAILED" exit-status="FAILED_AT_DECIDER"/>
  <end on="COMPLETED" exit-status="COMPLETED_AT_DECIDER"/>
  <stop on="MY_TEMP_ISSUE_EXIST_STATUS" restart="step2"/>
  <next on="
</decision>

Java#Glassfish


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS   sitemap
Last-modified: 2014-05-24 (土) 22:52:44 (3618d)
Short-URL: https://at-sushi.com:443/pukiwiki/index.php?cmd=s&k=e151e897c2
ISBN10
ISBN13
9784061426061