File tree Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Original file line number Diff line number Diff line change @@ -13,40 +13,6 @@ async def test() -> None:
1313 print (" The best task ever!" )
1414```
1515
16- ## Non-obvious things
17-
18- You can send delayed messages using labels.
19-
20- ## Delays
21-
22- To send delayed message, you have to specify
23- delay label. You can do it with ` task ` decorator,
24- or by using kicker. For example:
25-
26- ``` python
27- broker = AioKafkaBroker(bootstrap_servers = " localhost" )
28-
29- @broker.task (delay = 3 )
30- async def delayed_task () -> int :
31- return 1
32-
33- async def main ():
34- await broker.startup()
35- # This message will be received by workers
36- # After 3 seconds delay.
37- await delayed_task.kiq()
38-
39- # This message is going to be received after the delay in 4 seconds.
40- # Since we overriden the `delay` label using kicker.
41- await delayed_task.kicker().with_labels(delay = 4 ).kiq()
42-
43- # This message is going to be send immediately. Since we deleted the label.
44- await delayed_task.kicker().with_labels(delay = None ).kiq()
45-
46- # Of course the delay is managed by rabbitmq, so you don't
47- # have to wait delay period before message is going to be sent.
48- ```
49-
5016## Configuration
5117
5218AioKafkaBroker parameters:
You can’t perform that action at this time.
0 commit comments