File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -370,28 +370,20 @@ def start_consuming(
370370 :param kwargs: 其他参数
371371 """
372372 channel = self .get_channel (channel_id )
373-
374- def wrapper (message : Message ):
375- try :
376- callback (message )
377- message .ack ()
378- except Exception as exc :
379- logger .exception (f"Error processing message: { exc } " )
380- message .nack (requeue = True )
381373
382374 # 设置预取数量
383375 channel .basic .qos (prefetch_count = prefetch )
384376
385377 # 开始消费
386378 channel .basic .consume (
387- callback = wrapper ,
379+ callback = callback ,
388380 queue = queue_name ,
389381 ** kwargs
390382 )
391383
392384 # 启动消费循环
393385 try :
394- channel .start_consuming ()
386+ channel .start_consuming (to_tuple = False )
395387 except KeyboardInterrupt :
396388 logger .info ("Consuming interrupted by user" )
397389 channel .stop_consuming ()
You can’t perform that action at this time.
0 commit comments