-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtask_globals.py
40 lines (28 loc) · 1 KB
/
task_globals.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from aio_pika import ExchangeType
from pydantic import BaseModel
class MyExchange(BaseModel):
name: str
type: ExchangeType
durable: bool
auto_delete: bool
class TelegramClientWorkerExchange(MyExchange):
name = "telegram_client_worker_exchange"
type = ExchangeType.DIRECT
durable = False
auto_delete = True
class SchedulerExchange(MyExchange):
name = "scheduler_exchange"
type = ExchangeType.DIRECT
durable = False
auto_delete = True
class RabbitMQWorkerCommandExchange(MyExchange):
name = "rabbitmq_worker_command_exchange"
type = ExchangeType.FANOUT
durable = False
auto_delete = True
telegram_client_worker_exchange = TelegramClientWorkerExchange()
scheduler_exchange = SchedulerExchange()
rabbitmq_worker_command_exchange = RabbitMQWorkerCommandExchange()
# this queue is for distributing general tasks among all client workers
telegram_workers_general_task_queue_name = "telegram_workers_general_task_queue"
scheduler_queue_name = "scheduler_queue"