예제 #1
0
 public function consume($channel, $queue = '', $consumerTag = '', $noLocal = false, $noAck = false, $exclusive = false, $nowait = false, $arguments = [])
 {
     $buffer = new Buffer();
     $buffer->appendUint16(60);
     $buffer->appendUint16(20);
     $buffer->appendInt16(0);
     $buffer->appendUint8(strlen($queue));
     $buffer->append($queue);
     $buffer->appendUint8(strlen($consumerTag));
     $buffer->append($consumerTag);
     $this->getWriter()->appendBits([$noLocal, $noAck, $exclusive, $nowait], $buffer);
     $this->getWriter()->appendTable($arguments, $buffer);
     $frame = new Protocol\MethodFrame(60, 20);
     $frame->channel = $channel;
     $frame->payloadSize = $buffer->getLength();
     $frame->payload = $buffer;
     $this->getWriter()->appendFrame($frame, $this->getWriteBuffer());
     $this->flushWriteBuffer();
     return $this->awaitConsumeOk($channel);
 }