Skip to content

Commit 311d7f8

Browse files
committed
Rename brokers
1 parent 659e796 commit 311d7f8

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ pip install taskiq-redis
1616
# Usage
1717

1818
Let's see the example with the redis broker and redis async result:
19+
1920
```python
2021
import asyncio
2122

22-
from taskiq_redis.redis_broker import RedisBroker
23+
from taskiq_redis.redis_broker import ListQueueBroker
2324
from taskiq_redis.redis_backend import RedisAsyncResultBackend
2425

25-
2626
redis_async_result = RedisAsyncResultBackend(
2727
redis_url="redis://localhost:6379",
2828
)
2929

30-
# Or you can use BroadcastRedisBroker if you need broadcasting
31-
broker = RedisBroker(
30+
# Or you can use PubSubBroker if you need broadcasting
31+
broker = ListQueueBroker(
3232
url="redis://localhost:6379",
3333
result_backend=redis_async_result,
3434
)

taskiq_redis/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Package for redis integration."""
22
from taskiq_redis.redis_backend import RedisAsyncResultBackend
3-
from taskiq_redis.redis_broker import RedisBroker
3+
from taskiq_redis.redis_broker import ListQueueBroker
44

5-
__all__ = ["RedisAsyncResultBackend", "RedisBroker"]
5+
__all__ = ["RedisAsyncResultBackend", "ListQueueBroker"]

taskiq_redis/redis_broker.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ async def _listen_to_raw_messages(self) -> AsyncGenerator[bytes, None]:
8686
yield # type: ignore
8787

8888

89-
class BroadcastRedisBroker(BaseRedisBroker):
90-
"""Broker that works with Redis and broadcasts a task to all workers."""
89+
class PubSubBroker(BaseRedisBroker):
90+
"""Broker that works with Redis and broadcasts tasks to all workers."""
9191

9292
async def kick(self, message: BrokerMessage) -> None: # noqa: D102
9393
async with Redis(connection_pool=self.connection_pool) as redis_conn:
@@ -103,8 +103,8 @@ async def _listen_to_raw_messages(self) -> AsyncGenerator[bytes, None]:
103103
yield message["data"]
104104

105105

106-
class RedisBroker(BaseRedisBroker):
107-
"""Broker that works with Redis."""
106+
class ListQueueBroker(BaseRedisBroker):
107+
"""Broker that works with Redis and distributes tasks between workers."""
108108

109109
async def kick(self, message: BrokerMessage) -> None: # noqa: D102
110110
async with Redis(connection_pool=self.connection_pool) as redis_conn:

0 commit comments

Comments
 (0)