org.apache.storm.trident.spout

## Interface ITridentSpout.BatchCoordinator<X>

- All Known Implementing Classes:
    BatchSpoutExecutor.EmptyCoordinator, FeederBatchSpout.FeederCoordinator, OpaquePartitionedTridentSpoutExecutor.Coordinator
  Enclosing interface:
    ITridentSpout<T>

      public static interface ITridentSpout.BatchCoordinator<X>

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Release any resources from this coordinator.
    `X` | `initializeTransaction(long txid, X prevMetadata, X currMetadata)` Create metadata for this particular transaction id which has never been emitted before.
    `boolean` | `isReady(long txid)` hint to Storm if the spout is ready for the transaction id.
    `void` | `success(long txid)` This attempt committed successfully, so all state for this commit and before can be safely cleaned up.

- - ### Method Detail

    - #### initializeTransaction

          X initializeTransaction(long txid,
                                  X prevMetadata,
                                  X currMetadata)

      Create metadata for this particular transaction id which has never been emitted before. The metadata should contain whatever is necessary to be able to replay the exact batch for the transaction at a later point.

      The metadata is stored in Zookeeper.

      Storm uses JSON encoding to store the metadata. Only simple types such as numbers, booleans, strings, lists, and maps should be used.

      Parameters:
        `txid` - The id of the transaction.
        `prevMetadata` - The metadata of the previous transaction
        `currMetadata` - The metadata for this transaction the last time it was initialized. null if this is the first attempt
      Returns:
        the metadata for this new transaction

    - #### success

          void success(long txid)

      This attempt committed successfully, so all state for this commit and before can be safely cleaned up.

      Parameters:
        `txid` - transaction id that completed

    - #### isReady

          boolean isReady(long txid)

      hint to Storm if the spout is ready for the transaction id.

      Parameters:
        `txid` - the id of the transaction
      Returns:
        true, if the spout is ready for the given transaction id

    - #### close

          void close()

      Release any resources from this coordinator.

Copyright © 2021 The Apache Software Foundation. All rights reserved.