proxystore.stream.shims.redis¶
Redis publisher and subscriber shims.
Shims to the
redis-py
Publish / Subscribe interface.
RedisPublisher
¶
Redis pub/sub publisher shim.
Note
In Redis pub/sub, all subscribers will receive all messages, and
messages will be dropped if no subscribers are present. The
RedisQueuePublisher
provides message persistence and single consumption messages.
Parameters:
-
hostname
(str
) –Redis server hostname.
-
port
(int
) –Redis server port.
-
kwargs
(Any
, default:{}
) –Extra keyword arguments to pass to
redis.Redis()
.
Source code in proxystore/stream/shims/redis.py
RedisSubscriber
¶
Redis pub/sub subscriber shim.
This shim is an iterable object which will yield bytes
messages from the stream, blocking on the next message, until the stream
is closed.
Parameters:
-
hostname
(str
) –Redis server hostname.
-
port
(int
) –Redis server port.
-
topic
(str | Sequence[str]
) –Topic or sequence of topics to subscribe to.
-
kwargs
(Any
, default:{}
) –Extra keyword arguments to pass to
redis.Redis()
.
Source code in proxystore/stream/shims/redis.py
RedisQueuePublisher
¶
Redis queue publisher shim.
Note
Only a single subscriber will be able to read each message sent to the
queue. The
RedisPublisher
uses pub/sub and supports broadcasting messages to all active
subscribers.
Parameters:
-
hostname
(str
) –Redis server hostname.
-
port
(int
) –Redis server port.
-
kwargs
(Any
, default:{}
) –Extra keyword arguments to pass to
redis.Redis()
.
Source code in proxystore/stream/shims/redis.py
RedisQueueSubscriber
¶
RedisQueueSubscriber(
hostname: str,
port: int,
topic: str,
*,
timeout: int | None = None,
**kwargs: Any
)
Redis queue subscriber shim.
This shim is an iterable object which will yield bytes
messages from the queue, blocking on the next message, forever.
Parameters:
-
hostname
(str
) –Redis server hostname.
-
port
(int
) –Redis server port.
-
topic
(str
) –Topic to subscribe to (I.e., the name of the key corresponding to a Redis list).
-
timeout
(int | None
, default:None
) –Timeout for waiting on the next item. If
None
, the timeout will be set to one second but will loop indefinitely. -
kwargs
(Any
, default:{}
) –Extra keyword arguments to pass to
redis.Redis()
.