Enum ProcessingGuarantee

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ProcessingGuarantee>

    public enum ProcessingGuarantee
    extends java.lang.Enum<ProcessingGuarantee>
    Defines what message processing guarantees are given under failure conditions. Specifically, if a member of the cluster leaves the cluster during job execution and the job is restarted automatically it defines the semantics of at which point in the stream the job is resumed from.

    When AT_LEAST_ONCE or EXACTLY_ONCE is set, distributed snapshotting will be enabled for the job. The distributed snapshot algorithm works by sending barriers down the stream which upon receiving causes the processors to save their state as a snapshot. Snapshots are saved in memory and replicated across the cluster.

    Since a processor can have multiple inputs, it must wait until the barrier is received from all inputs before taking a snapshot. The difference between AT_LEAST_ONCE and EXACTLY_ONCE is that in AT_LEAST_ONCE mode the processor can continue to process items from inputs which have already received the barrier. This will result in lower latency and higher throughput overall, with the caveat that some items may be processed twice after a restart.

    Since:
    Jet 3.0
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      AT_LEAST_ONCE
      Enables at-least-once processing semantics.
      EXACTLY_ONCE
      Enables exactly-once processing semantics.
      NONE
      No processing guarantees are given and no snapshots are taken during job execution.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ProcessingGuarantee valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static ProcessingGuarantee[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • NONE

        public static final ProcessingGuarantee NONE
        No processing guarantees are given and no snapshots are taken during job execution. When a job is restarted automatically it will be as if the job is starting from scratch which can cause items to be lost or duplicated.

        This option provides the overall best throughput and latency and no storage overheads from snapshotting. However, it doesn't provide any correctness guarantees under failure.

      • AT_LEAST_ONCE

        public static final ProcessingGuarantee AT_LEAST_ONCE
        Enables at-least-once processing semantics. When a job is restarted it will be resumed from the latest available snapshot. Items which have been processed before the snapshot might be processed again after the job is resumed.

        This option requires in-memory snapshotting which will cause additional storage requirements and overhead compared to NONE. However it provides better latency than EXACTLY_ONCE with weaker guarantees.

      • EXACTLY_ONCE

        public static final ProcessingGuarantee EXACTLY_ONCE
        Enables exactly-once processing semantics. When a job is restarted it will be resumed from the latest available snapshot. Items which have been processed before the snapshot are guaranteed not to be processed again after the job is resumed.

        This option requires in-memory snapshotting which will cause additional storage requirements and overhead compared to NONE. It provides the strongest correctness guarantee. However latency might increase due to the aligning of barriers which are required in this processing mode.

    • Method Detail

      • values

        public static ProcessingGuarantee[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ProcessingGuarantee c : ProcessingGuarantee.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ProcessingGuarantee valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null