Skip to content

Commit

Permalink
bschmitt#1 added reject method
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmitt committed Jan 5, 2016
1 parent 6b9a558 commit 959589a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/Consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Consumer extends Request
* @param string $queue
* @param Closure $closure
* @return bool
* @throws \Exception
*/
public function consume($queue, Closure $closure)
{
Expand Down Expand Up @@ -75,6 +76,8 @@ function ($message) use ($closure, $object) {
}

/**
* Acknowledges a message
*
* @param Message $message
*/
public function acknowledge($message)
Expand All @@ -87,6 +90,19 @@ public function acknowledge($message)
}

/**
* Rejects a message and requeues it if wanted (default: false)
*
* @param Message $message
* @param bool $requeue
*/
public function reject($message, $requeue = false)
{
$message->delivery_info['channel']->basic_reject($message->delivery_info['delivery_tag'], $requeue);
}

/**
* Stops consumer when no message is left
*
* @throws Exception\Stop
*/
public function stopWhenProcessed()
Expand Down
1 change: 0 additions & 1 deletion src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ class Message extends AMQPMessage
{

}

0 comments on commit 959589a

Please sign in to comment.