Metadata-Version: 2.3
Name: eric-redis-queues
Version: 3.1.0
Summary: Redis support for eric-sse
License: MIT
Keywords: sse,server sent events,queue,concurrency
Author: Luca Stretti
Author-email: laxertu@gmail.com
Requires-Python: >=3.10, <3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: asyncio (>=3.4.3,<3.4.4)
Requires-Dist: eric-sse (==3.0.0)
Requires-Dist: redis (==6.2.0)
Project-URL: Homepage, https://laxertu.github.io/eric-redis-queues
Project-URL: Issues, https://github.com/laxertu/eric/issues
Project-URL: Repository, https://github.com/laxertu/eric-redis-queues
Description-Content-Type: text/markdown

Redis support for eric-sse

*Installation*

pip install eric-redis-queues

*Usage*

```python
from eric_sse.prefabs import SSEChannel
from eric_redis_queues import RedisConnection
from eric_redis_queues.repository import redis_channel_repository_builder

redis_connection = RedisConnection(host='127.0.0.1', port=6379, db=0)

# Channels, connections, listeners and queues persisted in Redis; messages kept in Redis lists
repository = redis_channel_repository_builder(SSEChannel, redis_connection).build()
```

The returned builder is an eric-sse `ChannelRepositoryBuilder`, so it can be further configured (listeners, error
handlers) before `build()`.

*Migrating from 2.x*

* `RedisConnectionRepository`, `RedisSSEChannelRepository`, `RedisListenerRepository` and the connection factories
  are replaced by `redis_channel_repository_builder`.
* `BlockingRedisQueue` and `RedisSSEChannelBlockingQueuesRepository` are removed: in eric-sse 3 waiting is up to the
  caller, e.g. `await channel.wait_next(connection_id, timeout)`. See the
  [changelog](docs/source/changelog.rst#blocking-queues) for why, and how to get the same behaviour.
* `RedisStorage(redis_connection, prefix)`: arguments swapped, and `prefix` has a default.
* Keys layout changed: data persisted by 2.x is not readable by 3.x.

*Tests*

Integration tests run eric-sse contracts against a real Redis. Only `eric-redis-queues:*` keys are deleted.

```
REDIS_HOST=127.0.0.1 REDIS_PORT=6379 REDIS_DB=15 python -m pytest tests
```

Tests are skipped if Redis is not reachable.

*Related packages*

* https://pypi.org/project/eric-sse/ Base project

Documentation: https://laxertu.github.io/eric-redis-queues/

