• 请不要在回答技术问题时复制粘贴 AI 生成的内容
justseemore
V2EX  ›  程序员

求解惑,关于 rabbitmq 的 consumer

  •  
  •   justseemore · Jul 2, 2019 · 2080 views
    This topic created in 2541 days ago, the information mentioned may be changed or developed.
    //伪代码
    
    $queue = new queue();
    //方式 1
    while(true){
        $message = $queue->get();
        $queue->ack();
    }
    //方式 2
    $queue->consume(function(){
        
    });
    

    这两种消费的方式有什么区别?

    2 replies    2019-07-03 12:04:31 +08:00
    ilucio
        1
    ilucio  
       Jul 3, 2019 via Android
    第一种是客户端主动获取队列里的数据,第二种是队列向客户端推送数据
    justseemore
        2
    justseemore  
    OP
       Jul 3, 2019
    @ilucio #1 谢谢哈,我去研究下源码去
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5204 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 08:41 · PVG 16:41 · LAX 01:41 · JFK 04:41
    ♥ Do have faith in what you're doing.