feat: Notification service qo'shildi va RabbitMQ integratsiya qilindi

This commit is contained in:
A'zamov Samandar
2025-04-20 16:15:04 +05:00
parent bc24faeedd
commit a3e8ed3e36
15 changed files with 357 additions and 6 deletions

17
test.py Normal file
View File

@@ -0,0 +1,17 @@
from kombu import Connection, Exchange, Producer
# RabbitMQ ulanishi
rabbit_url = 'amqp://guest:guest@127.0.0.1:5672/'
connection = Connection(rabbit_url)
channel = connection.channel()
exchange = Exchange('notification', type='direct')
# Producer yaratish
producer = Producer(channel, exchange=exchange, routing_key="notification")
# Xabar yuborish
message = {'type': 'email', 'message': 'Hello, Workers!', "to": ["+998888112309", "+998943990509"]}
producer.publish(message)
print("Message sent to all workers!")