Redis adapter for FastMesh — RedisSource and RedisSink via redis-py async
Project description
fastmesh-redis
Redis Streams adapter for FastMesh —
RedisSource and RedisSink via redis-py async.
Install
pip install fastmesh-redis
Usage
from fastmesh import Bus
from fastmesh_redis import RedisSource, RedisSink
source = RedisSource(
stream="orders",
group="pipeline",
consumer="worker-1",
url="redis://localhost:6379",
)
sink = RedisSink(
stream="processed-orders",
url="redis://localhost:6379",
maxlen=10_000,
)
await Bus().source(source).sink(sink).run()
RedisSource
Consumes from a Redis Stream using XREADGROUP. Each entry → one Message.
| Parameter | Default | Description |
|---|---|---|
stream |
(required) | Stream key name |
group |
(required) | Consumer group name (created if missing) |
consumer |
"fastmesh" |
Consumer name |
url |
"redis://localhost:6379" |
Redis URL |
block_ms |
1000 |
XREADGROUP block timeout (ms) |
batch_size |
10 |
Max entries per read |
pending_on_start |
True |
Re-process unacknowledged entries on start |
Entries are auto-acknowledged (XACK) after yielding. The payload is read from
the "payload" field (JSON-decoded) or merged from all fields if absent.
RedisSink
Publishes to a Redis Stream using XADD.
| Parameter | Default | Description |
|---|---|---|
stream |
(required) | Stream key name |
url |
"redis://localhost:6379" |
Redis URL |
maxlen |
None |
Approximate stream max length |
extra_fields_fn |
None |
(Message) -> dict[str, str] extra entry fields |
The Redis connection is lazily initialized and reused. Call await sink.stop() on shutdown.
Requirements
- Python 3.11+
- fastmesh >= 0.2
- redis[asyncio] >= 5.0 (redis-py with async support)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastmesh_redis-0.1.0.tar.gz.
File metadata
- Download URL: fastmesh_redis-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32d1734333a40ac0d86333f8a9546c949545ce30756d3f17fb14f81717595f79
|
|
| MD5 |
ff00f6a2daf57ee57e9cf1eeff85ef0c
|
|
| BLAKE2b-256 |
1b7bb75d86c81abac701b85a5c3c4fa56898084e1c9afd678672c08e1b69c62a
|
File details
Details for the file fastmesh_redis-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fastmesh_redis-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9288776f4980dbb25c5cc2f69af3044261f3aa244d1492c5f75ac1c19ca2a352
|
|
| MD5 |
c66e3b31b289e76d89d1e1083adb7af8
|
|
| BLAKE2b-256 |
be73d6e9af60fbb548ca70a73d1d30825ca65bfb34781a656a92d349cfd0121d
|