SubscriptionOptions

class SubscriptionOptions @InternalWowApi constructor(val maxInFlight: Int, val retry: RetryPolicy = RetryPolicy(), val checkpointInterval: Duration = 1.seconds, val stopTimeout: Duration = 10.seconds, val readRetry: RetryPolicy = RetryPolicy( maxAttempts = 5, initialBackoff = 100.milliseconds, maxBackoff = 5.seconds ), val starts: Map<SubscriptionId, SubscriptionStart> = emptyMap(), val parked: ParkedRetryOptions = ParkedRetryOptions(), val retries: Map<SubscriptionId, HandlerRetry> = emptyMap(), val systemic: SystemicFailureOptions = SystemicFailureOptions(), val backpressure: BackpressureOptions = BackpressureOptions(), val maxCatchUps: Int = DEFAULT_MAX_CATCH_UPS)

The tuning of a SubscriptionRuntime.

  • maxInFlight: the entries one subscription may hold in one partition between its checkpoint and the last entry it took. It bounds both memory and what a crash replays; a subscription that reaches it stops taking entries from the shared tail and catches up on its own once it has room.

  • retry: how a failing handler is retried before its aggregate is parked, unless its subscription has a budget of its own (retryOf).

  • checkpointInterval: how often each subscription saves its checkpoint; SubscriptionRuntime.stop saves too.

  • stopTimeout: how long a stop waits for the handlers in flight before abandoning them; an abandoned entry is above the saved checkpoint, so it is handled again after the restart.

  • readRetry: the backoff of a log read or a store write that failed; they are retried until the runtime stops. Its RetryPolicy.maxAttempts is the attempts after which the failure is logged as an error and retried at the maximum backoff (retryForever).

  • starts: by subscription (SubscriptionId), where a subscription without a checkpoint in a partition starts instead of where its handler says (a projection from the beginning, a reactor or a saga from the end), as wow.subscriptions.[<context>.<name>].start configures it. A subscription with a checkpoint goes on from it.

  • parked: how the parked entries are retried over the long horizon.

  • retries: by subscription (SubscriptionId), the in-process retry budget the host gives it, as wow.subscriptions.[<context>.<name>].retry.* configures it: each setting given replaces the handler's own (@Retry, Subscription.retry), each one not given is the handler's, else retry's.

  • systemic: when a subscription takes its failures for systemic and pauses its partition instead of charging and parking the aggregates.

  • backpressure: how a subscription retries an entry whose downstream asked it to come back later, and throttles its partition meanwhile.

  • maxCatchUps: the partitions a node reads behind their head at once, all its subscription runtimes together; 0 for no bound. A partition whose subscriptions start behind the head of its source (a history migrate-data imported, a long stop) waits for one before it reads, in the order the partitions asked, and gives it back once each of its subscriptions has taken every entry up to that head, paused on a systemic failure, or stalled; the others stand at their checkpoints meanwhile. So a node catching up on a large backlog keeps its store for its commands.

Fields may be added: Wow builds it from the host's configuration, so the constructor is internal to Wow.

Constructors

Link copied to clipboard
constructor(maxInFlight: Int, retry: RetryPolicy = RetryPolicy(), checkpointInterval: Duration = 1.seconds, stopTimeout: Duration = 10.seconds, readRetry: RetryPolicy = RetryPolicy( maxAttempts = 5, initialBackoff = 100.milliseconds, maxBackoff = 5.seconds ), starts: Map<SubscriptionId, SubscriptionStart> = emptyMap(), parked: ParkedRetryOptions = ParkedRetryOptions(), retries: Map<SubscriptionId, HandlerRetry> = emptyMap(), systemic: SystemicFailureOptions = SystemicFailureOptions(), backpressure: BackpressureOptions = BackpressureOptions(), maxCatchUps: Int = DEFAULT_MAX_CATCH_UPS)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun copyWith(maxInFlight: Int = this.maxInFlight, retry: RetryPolicy = this.retry, checkpointInterval: Duration = this.checkpointInterval, stopTimeout: Duration = this.stopTimeout, readRetry: RetryPolicy = this.readRetry, starts: Map<SubscriptionId, SubscriptionStart> = this.starts, parked: ParkedRetryOptions = this.parked, retries: Map<SubscriptionId, HandlerRetry> = this.retries, systemic: SystemicFailureOptions = this.systemic, backpressure: BackpressureOptions = this.backpressure, maxCatchUps: Int = this.maxCatchUps): SubscriptionOptions

This SubscriptionOptions with the given fields replaced: Wow's own copy, left out of the ABI.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

How subscription's failing handler is retried before its aggregate is parked: the host's retries for its name, over its handler's own Subscription.retry, over retry.

Link copied to clipboard
open override fun toString(): String