Permalink
Browse files

implements basick_nack

  • Loading branch information...
1 parent 3dcde8f commit 85ff1412152e2de8519dc75ffb741fe3adf89b9c @videlalvaro videlalvaro committed Oct 22, 2012
@@ -36,6 +36,7 @@ class AMQPChannel extends AbstractChannel
"90,21" => "tx_commit_ok",
"90,31" => "tx_rollback_ok"
);
+
/**
*
* @var callable these parameters will be passed to function
@@ -451,10 +452,19 @@ public function basic_ack($delivery_tag, $multiple=false)
$this->send_method_frame(array(60, 80), $args);
}
+ /**
+ * reject one or several received messages.
+ */
+ public function basic_nack($delivery_tag, $multiple=false, $requeue=false)
+ {
+ $args = $this->frameBuilder->basicNack($delivery_tag, $multiple, $requeue);
+ $this->send_method_frame(array(60, 120), $args);
+ }
+
/**
* end a queue consumer
*/
- public function basic_cancel($consumer_tag, $nowait=false)
+ public function basic_cancel($consumer_tag, $nowait=false)
{
$args = $this->frameBuilder->basicCancel($consumer_tag, $nowait);
$this->send_method_frame(array(60, 30), $args);
@@ -83,6 +83,7 @@ class AbstractChannel
"60,90" => "Channel.basic_reject",
"60,110" => "Channel.basic_recover",
"60,111" => "Channel.basic_recover_ok",
+ "60,120" => "Channel.basic_nack",
"90,10" => "Channel.tx_select",
"90,11" => "Channel.tx_select_ok",
"90,20" => "Channel.tx_commit",
@@ -177,6 +177,17 @@ public function basicAck($delivery_tag, $multiple)
return $args;
}
+ public function basicNack($delivery_tag, $multiple, $requeue)
+ {
+ $args = new AMQPWriter();
+ $args->write_longlong($delivery_tag)
+ ->write_bit($multiple)
+ ->write_bit($requeue)
+ ;
+
+ return $args;
+ }
+
public function basicCancel($consumer_tag, $nowait)
{
$args = new AMQPWriter();

2 comments on commit 85ff141

according to http://www.rabbitmq.com/amqp-0-9-1-quickref.html#basic.nack

THIS METHOD IS A RABBITMQ-SPECIFIC EXTENSION OF AMQP

Collaborator

videlalvaro replied Oct 23, 2012

Yes

Please sign in to comment.