クラス SimpleChunkProcessor<I,O>

java.lang.ObjectSE
org.springframework.batch.core.step.item.SimpleChunkProcessor<I,O>
実装されたすべてのインターフェース:
ChunkProcessor<I>org.springframework.beans.factory.InitializingBean
既知の直属サブクラス
FaultTolerantChunkProcessor

public class SimpleChunkProcessor<I,O> extends ObjectSE implements ChunkProcessor<I>, org.springframework.beans.factory.InitializingBean
基本的なアイテムの書き込みと処理を処理する ChunkProcessor インターフェースのシンプルな実装。発生した例外は再スローされます。
関連事項:
  • フィールドの詳細

    • meterRegistry

      protected io.micrometer.core.instrument.MeterRegistry meterRegistry
  • コンストラクターの詳細

    • SimpleChunkProcessor

      public SimpleChunkProcessor(@Nullable ItemProcessor<? super I,? extends O> itemProcessor, ItemWriter<? super O> itemWriter)
    • SimpleChunkProcessor

      public SimpleChunkProcessor(ItemWriter<? super O> itemWriter)
  • メソッドの詳細

    • setItemProcessor

      public void setItemProcessor(ItemProcessor<? super I,? extends O> itemProcessor)
      パラメーター:
      itemProcessor - 設定する ItemProcessor
    • setItemWriter

      public void setItemWriter(ItemWriter<? super O> itemWriter)
      パラメーター:
      itemWriter - 設定する ItemWriter
    • setMeterRegistry

      public void setMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry)
      メトリクスに使用するメーターレジストリを設定します。
      パラメーター:
      meterRegistry - メーター登録
      導入:
      5.0
    • afterPropertiesSet

      public void afterPropertiesSet() throws ExceptionSE
      必須プロパティを確認してください。
      次で指定:
      インターフェース org.springframework.beans.factory.InitializingBeanafterPropertiesSet 
      例外:
      ExceptionSE
      関連事項:
      • InitializingBean.afterPropertiesSet()
    • setListeners

      public void setListeners(ListSE<? extends StepListener> listeners)
      いくつかの StepListener をハンドラーに登録します。それぞれが正しい段階で指定された順序でコールバックを取得します。
      パラメーター:
      listeners - StepListener インスタンスのリスト。
    • registerListener

      public void registerListener(StepListener listener)
      プロセスの適切な段階でコールバックのリスナーを登録します。
      パラメーター:
      listener - StepListener
    • getListener

      protected MulticasterBatchListener<I,O> getListener()
      戻り値:
      リスナー
    • doProcess

      protected final O doProcess(I item) throws ExceptionSE
      パラメーター:
      item - 入力項目
      戻り値:
      処理の結果
      例外:
      ExceptionSE - エラーが発生した場合にスローされます。
    • doWrite

      protected final void doWrite(Chunk<O> items) throws ExceptionSE
      実際の書き込み呼び出しをリスナーコールバックで囲みます。
      パラメーター:
      items - 書き込まれるアイテムのリスト。
      例外:
      ExceptionSE - エラーが発生した場合にスローされます。
    • doAfterWrite

      protected final void doAfterWrite(Chunk<O> items)
      リスナーの after write メソッドを呼び出します。
      パラメーター:
      items - 書き込まれたばかりのアイテムのリスト。
    • doOnWriteError

      protected final void doOnWriteError(ExceptionSE e, Chunk<O> items)
      リスナーの writerError メソッドを呼び出します。
      パラメーター:
      e - 発生した例外。
      items - 書き込みに失敗したアイテムのリスト。
    • writeItems

      protected void writeItems(Chunk<O> items) throws ExceptionSE
      パラメーター:
      items - 書き込まれるアイテムのリスト。
      例外:
      ExceptionSE - エラーが発生した場合にスローされます。
    • process

      public final void process(StepContribution contribution, Chunk<I> inputs) throws ExceptionSE
      次で指定:
      インターフェース ChunkProcessor<I>process 
      例外:
      ExceptionSE
    • initializeUserData

      protected void initializeUserData(Chunk<I> inputs)
      後でアカウンティングの目的で必要になった場合に備えて、サブクラスが入力内容を記憶できるようにするサブクラスの拡張ポイント。デフォルトの実装では、入力の元のサイズを記憶するためにいくつかのユーザーデータを設定します。このメソッドがオーバーライドされた場合、ユーザーデータが一貫して処理されるように、isComplete(Chunk)getFilterCount(Chunk, Chunk)getAdjustedOutputs(Chunk, Chunk) の一部またはすべても必要になる場合があります。
      パラメーター:
      inputs - プロセスへの入力
    • getFilterCount

      protected int getFilterCount(Chunk<I> inputs, Chunk<O> outputs)
      フィルター数を計算するためのサブクラスの拡張ポイント。デフォルトは、入力サイズと出力サイズの差です。
      パラメーター:
      inputs - 変換後の入力
      outputs - 変換後の出力
      戻り値:
      サイズの違い
      関連事項:
    • isComplete

      protected boolean isComplete(Chunk<I> inputs)
      入力に追加のデータを格納するサブクラスの拡張ポイント。デフォルトでは、入力が空かどうかをチェックするだけです。
      パラメーター:
      inputs - 入力チャンク
      戻り値:
      空の場合は true
      関連事項:
    • getAdjustedOutputs

      protected Chunk<O> getAdjustedOutputs(Chunk<I> inputs, Chunk<O> outputs)
      入力に保存された追加データに基づいて出力を調整するサブクラスの拡張ポイント。デフォルトの実装では、出力は変更されずに返されます。
      パラメーター:
      inputs - 変換の入力
      outputs - 変換の結果
      戻り値:
      出力は変更されません
      関連事項:
    • write

      protected void write(StepContribution contribution, Chunk<I> inputs, Chunk<O> outputs) throws ExceptionSE
      単純な実装では、doWrite(Chunk) メソッドに委譲し、コントリビューションの書き込みカウントをインクリメントします。サブクラスは、フォールトトレランスなど、より複雑なシナリオを処理できます。出力項目がスキップされた場合は、入力からも削除する必要があります。
      パラメーター:
      contribution - 現在のステップの貢献
      inputs - 出力を生じさせた入力
      outputs - 書き込む出力
      例外:
      ExceptionSE - 問題がある場合
    • transform

      protected Chunk<O> transform(StepContribution contribution, Chunk<I> inputs) throws ExceptionSE
      例外:
      ExceptionSE
    • stopTimer

      protected void stopTimer(io.micrometer.core.instrument.Timer.Sample sample, StepExecution stepExecution, StringSE metricName, StringSE status, StringSE description)