message broker sifatida redis qo'shildi
This commit is contained in:
24
README.MD
24
README.MD
@@ -72,7 +72,7 @@ Notifications should be published to the RabbitMQ exchange with the following JS
|
||||
}
|
||||
```
|
||||
|
||||
Python example
|
||||
Python example rabbitmq broker
|
||||
```python
|
||||
from kombu import Connection, Exchange, Producer
|
||||
|
||||
@@ -93,6 +93,28 @@ producer.publish(message)
|
||||
print("Message sent to all workers!")
|
||||
```
|
||||
|
||||
Python example redis broker
|
||||
```python
|
||||
import redis
|
||||
import json
|
||||
|
||||
# Redis ulanishi
|
||||
r = redis.StrictRedis(host='127.0.0.1', port=6379, db=0)
|
||||
|
||||
# Xabar tayyorlash
|
||||
message = {
|
||||
'type': 'email',
|
||||
'message': "Subject: test\r\n\r\nclasscom.uz sayti va mobil ilovasiga ro'yxatdan o'tishingiz uchun tasdiqlash kodi: 1234",
|
||||
'to': ["JscorpTech@gmail.com", "admin@jscorp.uz"]
|
||||
}
|
||||
|
||||
# Xabarni JSON formatga o‘tkazib, Redis listga push qilish
|
||||
r.rpush('notification', json.dumps(message))
|
||||
|
||||
print("Message pushed to Redis list!")
|
||||
|
||||
```
|
||||
|
||||
Available notification types:
|
||||
- `email`: For email notifications
|
||||
- `sms`: For SMS notifications
|
||||
|
||||
Reference in New Issue
Block a user