Durable topics¶
RedisBackend
¶
RedisBackend(
url: str = DEFAULT_URL,
*,
prefix: str = "aether:",
maxlen: int | None = DEFAULT_MAXLEN,
)
Connection and stream handling for durable topics.
Source code in python/aether/_redis.py
key
¶
client
¶
A client bound to the calling event loop.
redis-py's async connections belong to the loop that opened them, and Aether runs several worker loops, so each gets its own pool rather than sharing one that would break the moment a second loop touched it.
Source code in python/aether/_redis.py
ensure_group
async
¶
Create the group if it does not exist. start of "0" means a new
group sees everything still in the stream; "$" means only new messages.
Source code in python/aether/_redis.py
publish
async
¶
Source code in python/aether/_redis.py
tail
async
¶
Yield (id, value) for messages appended after start.
Runs forever; cancel the task to stop it.
Source code in python/aether/_redis.py
history
async
¶
Recent messages, oldest first. For replay and for tests.
Source code in python/aether/_redis.py
pending
async
¶
Messages this group has been given but not had acked.
A group-level question, so it needs no consumer. Creating one just to ask would add a member to the group that never reads anything.
Source code in python/aether/_redis.py
length
async
¶
trim
async
¶
close
async
¶
Consumer
¶
Consumer(
backend: RedisBackend,
topic: str,
group: str,
name: str,
*,
count: int = 32,
block_ms: int = BLOCK_MS,
claim_after_ms: int | None = 60000,
model: Any = None,
)
A member of a consumer group. Async-iterable over Message.
Each message goes to exactly one member of the group, and stays pending until acknowledged, which is what makes delivery at-least-once rather than at-most-once.