-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend.py
25 lines (22 loc) · 881 Bytes
/
send.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
import pika
import json
connection = pika.BlockingConnection(
pika.ConnectionParameters(host='localhost')
)
channel = connection.channel()
channel.queue_declare(queue='submission', durable=True)
message = [1, 1, '6a6d5544-f2e8-455d-9691-789cdb25bb2f', 'C++', 1, 256, ['RestaurantNekoya (1)', 'RestaurantNekoya (2)', 'RestaurantNekoya (3)', 'RestaurantNekoya (4)', 'RestaurantNekoya (5)', 'RestaurantNekoya (6)', 'RestaurantNekoya (7)', 'RestaurantNekoya (8)', 'RestaurantNekoya (9)', 'RestaurantNekoya (10)']]
channel.basic_publish(
exchange='',
routing_key='submission',
body=json.dumps(message),
properties=pika.BasicProperties(
delivery_mode=2, # make message persistent
))
print(" [x] Sent %r" % message)
connection.close()
"""
dispatch = mengirim
persistent = tetap/kokoh, dalam hal ini message tidak akan lost
acknowledgment = balasan
"""