Skip to content

Commit e60225e

Browse files
author
liu kelin
committed
消费
1 parent a238fd3 commit e60225e

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed
1.17 KB
Binary file not shown.
2.09 KB
Binary file not shown.

python_sync_nosql/queue_rabbitmq.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ def consumer_data():
3535
def callback(ch, method, properties, body):
3636

3737
# set data
38-
ack = sync_data.set_data(body)
38+
ack = sync_data.set_data(body)
39+
40+
# ACK 确认
41+
ch.basic_ack(delivery_tag = method.delivery_tag)
3942

40-
ch.basic_ack(delivery_tag = method.delivery_tag) # ACK 确认
4143

4244

4345
channel.basic_qos(prefetch_count=1) # 允许暂留Unacked数量,(数据未basic_ack前 数据保存在Unacked允许的最大值)

python_sync_nosql/startup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
print(' ====liukelin==== ')
1616
print(' [*] Waiting for messages. To exit press CTRL+C')
17-
get_rabbitmq.consumer_data()
17+
queue_rabbitmq.consumer_data()

0 commit comments

Comments
 (0)