Enum OrderingMode

java.lang.Object
java.lang.Enum<OrderingMode>
io.github.flink.gcp.connector.pubsub.source.OrderingMode
All Implemented Interfaces:
Serializable, Comparable<OrderingMode>, java.lang.constant.Constable

@Public public enum OrderingMode extends Enum<OrderingMode>
Whether the source preserves Pub/Sub ordering-key delivery order.

Ordered delivery is only meaningful for subscriptions created with enableMessageOrdering; see the connector documentation for the end-to-end guarantee and its cost.

toString() returns the hyphenated spelling rather than the constant name, because that spelling is what a SQL WITH clause is written in: Flink resolves an enum ConfigOption by matching the configured value against toString(), case-insensitively and with no other normalization. Flink's own DeliveryGuarantee carries its option spelling the same way.

  • Enum Constant Details

    • NONE

      public static final OrderingMode NONE
      No ordering guarantee (default), tuned for throughput. A subscription may be consumed by several reader subtasks concurrently — the split plan opens one subscriber client per subtask even when that means several on the same subscription — and Pub/Sub balances messages across them. Nothing waits on anything, and an ordering key may move between subtasks whenever streaming-pull affinity shifts.
    • PER_KEY

      public static final OrderingMode PER_KEY
      Preserves per-ordering-key delivery order within each subscription. Each subscription is assigned to exactly one reader subtask and its subscriber uses a single streaming-pull connection, so every message for a key is emitted by one subtask in delivery order.

      Ordering costs throughput, and most of that cost is Pub/Sub's rather than this source's: ordered delivery raises end-to-end latency, publish throughput is capped at 1 MB/s per ordering key, only one batch may be outstanding per key at a time, and unacknowledged messages for one key can delay delivery for other keys. Prefer the most granular ordering keys the data allows.

      This source adds two costs of its own: parallelism is effectively capped at the number of subscriptions (surplus subtasks receive no splits), and because acknowledgement waits for a checkpoint while only one batch may be outstanding per key, per-key throughput is bounded by roughly one batch per checkpoint interval.

      Order is preserved up to the source's output. Preserving it further requires partitioning the stream by the ordering key, for example keyBy(orderingKey).

  • Method Details

    • values

      public static OrderingMode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static OrderingMode valueOf(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:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • toString

      public String toString()
      Overrides:
      toString in class Enum<OrderingMode>