taskiq-redis 1.1.0__tar.gz → 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: taskiq-redis
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: Redis integration for taskiq
5
+ License-File: LICENSE
5
6
  Keywords: taskiq,tasks,distributed,async,redis,result_backend
6
7
  Author: taskiq-team
7
8
  Author-email: taskiq@norely.com
@@ -13,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.10
13
14
  Classifier: Programming Language :: Python :: 3.11
14
15
  Classifier: Programming Language :: Python :: 3.12
15
16
  Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
16
18
  Classifier: Programming Language :: Python :: 3 :: Only
17
19
  Classifier: Programming Language :: Python :: 3.8
18
20
  Requires-Dist: redis (>=6,<7)
@@ -213,3 +215,17 @@ scheduler = TaskiqScheduler(broker, [array_source])
213
215
 
214
216
  During startup the scheduler will try to migrate schedules from an old source to a new one. Please be sure to specify different prefixe just to avoid any kind of collision between these two.
215
217
 
218
+
219
+ ## Dynamic queue names
220
+
221
+
222
+ Brokers supports dynamic queue names, allowing you to specify different queues when kicking tasks. This is useful for routing tasks to specific queues based on runtime conditions, such as priority levels, tenant isolation, or environment-specific processing.
223
+
224
+ Simply pass the desired queue name as message's label when kicking a task to override the broker's default queue configuration.
225
+
226
+ ```python
227
+ @broker.task(queue_name="low_priority")
228
+ async def low_priority_task() -> None:
229
+ print("I don't mind waiting a little longer")
230
+ ```
231
+
@@ -189,3 +189,17 @@ scheduler = TaskiqScheduler(broker, [array_source])
189
189
  ```
190
190
 
191
191
  During startup the scheduler will try to migrate schedules from an old source to a new one. Please be sure to specify different prefixe just to avoid any kind of collision between these two.
192
+
193
+
194
+ ## Dynamic queue names
195
+
196
+
197
+ Brokers supports dynamic queue names, allowing you to specify different queues when kicking tasks. This is useful for routing tasks to specific queues based on runtime conditions, such as priority levels, tenant isolation, or environment-specific processing.
198
+
199
+ Simply pass the desired queue name as message's label when kicking a task to override the broker's default queue configuration.
200
+
201
+ ```python
202
+ @broker.task(queue_name="low_priority")
203
+ async def low_priority_task() -> None:
204
+ print("I don't mind waiting a little longer")
205
+ ```
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "taskiq-redis"
3
- version = "1.1.0"
3
+ version = "1.1.1"
4
4
  description = "Redis integration for taskiq"
5
5
  authors = ["taskiq-team <taskiq@norely.com>"]
6
6
  readme = "README.md"
@@ -251,9 +251,10 @@ class RedisStreamBroker(BaseRedisBroker):
251
251
 
252
252
  :param message: message to append.
253
253
  """
254
+ queue_name = message.labels.get("queue_name") or self.queue_name
254
255
  async with Redis(connection_pool=self.connection_pool) as redis_conn:
255
256
  await redis_conn.xadd(
256
- self.queue_name,
257
+ queue_name,
257
258
  {b"data": message.message},
258
259
  maxlen=self.maxlen,
259
260
  approximate=self.approximate,
@@ -310,7 +311,7 @@ class RedisStreamBroker(BaseRedisBroker):
310
311
  )
311
312
  logger.debug(
312
313
  "Found %d pending messages in stream %s",
313
- len(pending),
314
+ len(pending[1]),
314
315
  stream,
315
316
  )
316
317
  for msg_id, msg in pending[1]:
@@ -55,7 +55,8 @@ class ListQueueClusterBroker(BaseRedisClusterBroker):
55
55
 
56
56
  :param message: message to append.
57
57
  """
58
- await self.redis.lpush(self.queue_name, message.message) # type: ignore
58
+ queue_name = message.labels.get("queue_name") or self.queue_name
59
+ await self.redis.lpush(queue_name, message.message) # type: ignore
59
60
 
60
61
  async def listen(self) -> AsyncGenerator[bytes, None]:
61
62
  """
@@ -162,8 +163,9 @@ class RedisStreamClusterBroker(BaseRedisClusterBroker):
162
163
 
163
164
  :param message: message to append.
164
165
  """
166
+ queue_name = message.labels.get("queue_name") or self.queue_name
165
167
  await self.redis.xadd(
166
- self.queue_name,
168
+ queue_name,
167
169
  {b"data": message.message},
168
170
  maxlen=self.maxlen,
169
171
  approximate=self.approximate,
@@ -230,9 +230,10 @@ class RedisStreamSentinelBroker(BaseSentinelBroker):
230
230
 
231
231
  :param message: message to append.
232
232
  """
233
+ queue_name = message.labels.get("queue_name") or self.queue_name
233
234
  async with self._acquire_master_conn() as redis_conn:
234
235
  await redis_conn.xadd(
235
- self.queue_name,
236
+ queue_name,
236
237
  {b"data": message.message},
237
238
  maxlen=self.maxlen,
238
239
  approximate=self.approximate,
File without changes