Package com.aim2be.platform.outbox.redis
Class RedisOutboxKeys
java.lang.Object
com.aim2be.platform.outbox.redis.RedisOutboxKeys
Derives the four co-located Redis keys the backend touches, all sharing the
configured hash-tag prefix so a single Lua
EVAL stays single-slot in
cluster mode (refinement #8 — cluster-safe by construction; the dev cluster
is standalone today, but tagging now is free and removes a future migration).
Key layout for the default prefix {identity:outbox}:
{identity:outbox}:entries— Hash, field = event_id (UUID string), value =RedisOutboxEntryJSON.{identity:outbox}:pending— sorted-set, member = event_id, score =nextAttemptAtepoch-ms (refinement #5).{identity:outbox}:expiry-due— sorted-set, member = ticket-id, score =expiresAtepoch-ms (refinement #2 primitive; the identity-side due-time worker that consumes it is Phase 1).{identity:outbox}:lock— string, single-writer poller lock holding an owner token, released via compare-and-delete (refinement #4).
Redis Cluster hashes only the substring inside the first {...} when
assigning a slot, so every key above lands in the same slot — the EVAL
touching :entries + :pending (+ :expiry-due) is a
legal single-slot multi-key script.
-
Constructor Summary
ConstructorsConstructorDescriptionRedisOutboxKeys(String keyPrefix) Builds the key set from the configured hash-tag-bearing prefix. -
Method Summary
-
Constructor Details
-
RedisOutboxKeys
Builds the key set from the configured hash-tag-bearing prefix.- Parameters:
keyPrefix- the prefix INCLUDING its hash-tag braces (validated byRedisOutboxProperties.getKeyPrefix()); nevernull
-
-
Method Details
-
entries
- Returns:
- the Hash key (event_id → JSON entry).
-
pending
- Returns:
- the pending sorted-set key (event_id → nextAttemptAt score).
-
expiryDue
- Returns:
- the expiry-due sorted-set key (ticket_id → expiresAt score).
-
lock
- Returns:
- the single-writer poller lock key.
-