Class RedisOutboxScripts
RedisScript singletons the backend executes.
Per the Spring Data Redis scripting guide
(https://docs.spring.io/spring-data/redis/reference/redis/scripting.html,
verified 2026-05-28) a RedisScript should be configured ONCE in the
application context so its SHA1 is computed a single time; the executor then
attempts EVALSHA first and transparently falls back to EVAL
when the script is not yet cached server-side. Constructing a fresh script per
call would re-hash on every invocation — hence this holder.
The scripts live under META-INF/scripts/*.lua so the
.lua source is auditable + diffable independently of the Java that
invokes it (the fail-closed write ordering of refinement #1 is a property of
the .lua, not of the call site).
Result types follow the Spring Data Redis supported set (Long,
Boolean, List, String):
enqueue()→Long(1 enqueued / 0 idempotent no-op).markSent()→Long(1 applied / 0 no-op).markFailure()→List[applied, parked](bothLong).lockRenew()/lockRelease()→Long(1 owned / 0 not-owned).retentionDeleteSent()/repairReconcile()→Long(1 applied / 0 no-op).expiryDecide()→String(enqueued/duplicate/revoked/not_due).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.data.redis.core.script.RedisScript<Long>enqueue()org.springframework.data.redis.core.script.RedisScript<String>org.springframework.data.redis.core.script.RedisScript<Long>org.springframework.data.redis.core.script.RedisScript<Long>org.springframework.data.redis.core.script.RedisScript<List>org.springframework.data.redis.core.script.RedisScript<Long>markSent()org.springframework.data.redis.core.script.RedisScript<Long>org.springframework.data.redis.core.script.RedisScript<Long>
-
Constructor Details
-
RedisOutboxScripts
public RedisOutboxScripts()Loads every script from the classpath. Construction is the single SHA1 computation point (the scripts are cached as instance fields).
-
-
Method Details
-
enqueue
- Returns:
- the enqueue-one-PENDING script (refinements #1, #12).
-
markSent
- Returns:
- the PENDING→SENT transition script (status-guarded).
-
markFailure
- Returns:
- the failure-attempt script (re-score #5, park-to-FAILED #3);
returns
[applied, parked]
-
lockRenew
- Returns:
- the compare-and-renew lock script (refinement #4).
-
lockRelease
- Returns:
- the compare-and-delete lock-release script (refinement #4).
-
retentionDeleteSent
- Returns:
- the status-guarded SENT-retention HDEL script (refinement #9).
-
repairReconcile
- Returns:
- the zset/hash reconciliation script (refinement #10).
-
expiryDecide
- Returns:
- the expiry due-time decision script (refinement #2 primitive).
-