Class EffectStore
java.lang.Object
com.kingsrook.qqq.backend.core.jobs.effects.EffectStore
The jobs_effect outbox: write effects with a chunk's progress, claim due
effects (FOR UPDATE SKIP LOCKED where supported, else conditional updates),
record outcomes (fenced), and reap leases of dispatchers that died.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordCounts of a job's effects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClaim up to batch effects that are due: PENDING (deliver) and UNKNOWN not yet sent to review (reconcile).countsForJob(Integer jobId) A job's effects, summarized for its finalizer.Read an effect (as the system user).intinsertEffects(List<QRecord> effects, QBackendTransaction transaction) Write outbox rows (in the chunk's transaction when given).markNotDelivered(EffectLease lease, String message, boolean retry) Definitely not delivered: retry later with backoff, or FAILED when the attempts are used up (or retry is false).booleanmarkNotFound(EffectLease lease) A reconcile lookup found the effect was definitely not delivered: due again (safe to send).booleanmarkSent(EffectLease lease, String providerRef) Delivered.markUnknown(EffectLease lease, JobEffectType type, String message) The outcome is unknown (it may have been delivered).now()The database clock.query(QQueryFilter filter) Query the outbox (as the system user).Leases held past their expiry (the dispatcher died mid-delivery): the outcome is unknown.booleanresolve(Integer effectId, EffectStatus to, String note) Review: an operator resolves an effect (not while a dispatcher holds it).
-
Constructor Details
-
EffectStore
Constructor
-
-
Method Details
-
now
-
insertEffects
Write outbox rows (in the chunk's transaction when given). Keys already in the outbox are skipped, so a rerun chunk never doubles its effects.- Throws:
QException
-
claimDue
Claim up to batch effects that are due: PENDING (deliver) and UNKNOWN not yet sent to review (reconcile).- Throws:
QException
-
get
Read an effect (as the system user).- Throws:
QException
-
query
Query the outbox (as the system user).- Throws:
QException
-
markSent
Delivered. Fenced: false when the lease was lost (another holder decides).- Throws:
QException
-
markNotDelivered
public EffectStatus markNotDelivered(EffectLease lease, String message, boolean retry) throws QException Definitely not delivered: retry later with backoff, or FAILED when the attempts are used up (or retry is false).- Throws:
QException
-
markUnknown
public EffectStatus markUnknown(EffectLease lease, JobEffectType type, String message) throws QException The outcome is unknown (it may have been delivered). An idempotent effect is simply due again (same key); a non-idempotent one becomes UNKNOWN, to be reconciled - or, after the reconcile attempts, queued for review.- Throws:
QException
-
markNotFound
A reconcile lookup found the effect was definitely not delivered: due again (safe to send). Counts as a delivery attempt already made.- Throws:
QException
-
reapExpired
Leases held past their expiry (the dispatcher died mid-delivery): the outcome is unknown. Idempotent effects go back to PENDING (resent with the same key); others to UNKNOWN (reconcile, never a blind resend). Returns the job ids touched.- Throws:
QException
-
resolve
Review: an operator resolves an effect (not while a dispatcher holds it). to is SENT (it was delivered), PENDING (send it now) or FAILED (skip it).- Throws:
QException
-
countsForJob
A job's effects, summarized for its finalizer.- Throws:
QException
-