ParkedAggregate

class ParkedAggregate @InternalWowApi constructor(val subscription: SubscriptionId, val ref: AggregateRef, val partition: Int, val fromVersion: Int, val reason: String, val failedAt: Long, val fromPosition: Long? = null, val retries: Int = 0, val retryAt: Long? = null, val retrySpec: ParkedRetrySpec? = null, val recoverable: Recoverable = Recoverable.UNKNOWN, val request: LedgerRequest? = null, val nextAttemptAt: Long? = null, val revision: Long = 0)

One parked aggregate: subscription stopped handling ref, in its source's partition, at its stream fromVersion, at failedAt (epoch milliseconds), because of reason. The owner of partition retries it.

fromPosition is where that stream lies in the subscription's source when the source cannot be read by aggregate: the offset of its record in another context's topic, whose partition the ref's key always maps to. A retry re-scans that partition from it, keeping the records keyed by ref. Null for a subscription of the log, which reads an aggregate's streams by version. A topic of commands or receipts (–) commits nothing, so its subscription parks at fromVersion 1 and goes by fromPosition alone.

An entry whose source no longer retains fromPosition cannot be retried, only skipped: the runtime marks it unrecoverable by its reason, which then starts with UNRECOVERABLE.

Its long-horizon retry state: the owner of the aggregate's partition retries the entry automatically by a ParkedRetrySpec (retrySpec when an operator applied one, else the subscription's), retries times so far, the last one started at retryAt (epoch milliseconds). recoverable is what an operator marked it: an entry marked Recoverable.UNRECOVERABLE is not retried automatically, though it can still be retried by hand. request is an operator's retry or skip that the partition's owner has not taken yet.

nextAttemptAt (epoch milliseconds) is when the owner next looks at the entry: the next automatic retry it computed by the spec, NEVER for one that is not retried automatically, null until it has looked. Only the owner sets it (ParkedAmendment.Schedule); a retry claimed, and an operator's change of the entry, clear it, so the owner looks at the entry again on its next scan (FailureLedger.due). A retry spec changed in the host's configuration applies to an entry from the retry after the one it is scheduled for.

revision is the ledger's concurrency token, not an operator's fact: the number of stored changes of the entry since it parked (FailureLedger). A new entry is at 0, whatever it is constructed with.

Fields may be added: construct one with of; the constructor is internal to Wow.

Constructors

Link copied to clipboard
constructor(subscription: SubscriptionId, ref: AggregateRef, partition: Int, fromVersion: Int, reason: String, failedAt: Long, fromPosition: Long? = null, retries: Int = 0, retryAt: Long? = null, retrySpec: ParkedRetrySpec? = null, recoverable: Recoverable = Recoverable.UNKNOWN, request: LedgerRequest? = null, nextAttemptAt: Long? = null, revision: Long = 0)

Types

Link copied to clipboard
object Companion

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
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Whether the source no longer retains fromPosition: the entry can only be skipped.

Functions

Link copied to clipboard

This entry with amendment applied at the next revision, or null when the amendment names a revision read that the entry is no longer at: the reference semantics of FailureLedger.amend, for a backend that changes the entry in memory. Every amendment but a ParkedAmendment.Schedule and a ParkedAmendment.TakeRequest clears ParkedAggregate.nextAttemptAt, so the owner looks at the entry again on its next scan.

Link copied to clipboard
fun copyWith(subscription: SubscriptionId = this.subscription, ref: AggregateRef = this.ref, partition: Int = this.partition, fromVersion: Int = this.fromVersion, reason: String = this.reason, failedAt: Long = this.failedAt, fromPosition: Long? = this.fromPosition, retries: Int = this.retries, retryAt: Long? = this.retryAt, retrySpec: ParkedRetrySpec? = this.retrySpec, recoverable: Recoverable = this.recoverable, request: LedgerRequest? = this.request, nextAttemptAt: Long? = this.nextAttemptAt, revision: Long = this.revision): ParkedAggregate

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

Link copied to clipboard
fun ParkedAggregate.dueIn(partitions: Collection<Int>, now: Long): Boolean

Whether this entry is due at now in one of partitions (FailureLedger.due): the reference semantics, for a backend that filters in memory.

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

Whether spec's retries are spent: the entry is not retried automatically any more (9.x: not retryable).

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

When the next automatic retry under spec is due (epoch milliseconds), as 9.x computes it: spec's minimum backoff, doubled per retry made, after the last retry started (after the failure, before the first one), and not before the last retry's claim expired (ParkedRetrySpec.claimTtl), so a retry that may still run on the partition's former owner is not started twice. Null when the entry is not retryable.

Link copied to clipboard

This entry where entry parks the aggregate (its partition, from version and position) and why (its reason and failure time), with this entry's retry state, at the next revision and no longer scheduled: the reference semantics of a FailureLedger.repark, and of a FailureLedger.park that replaces an entry.

Link copied to clipboard

Whether the entry is retried automatically under spec: its source still holds it, no operator marked it unrecoverable, and spec's retries are not spent.

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