Skip to content

Commit 2365003

Browse files
committed
add flag to not send ACKs in the consumer class
1 parent 934fe5f commit 2365003

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

RabbitMq/Consumer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ protected function handleProcessMessage(AMQPMessage $msg, $processFlag)
190190
} else if ($processFlag === ConsumerInterface::MSG_REJECT) {
191191
// Reject and drop
192192
$msg->delivery_info['channel']->basic_reject($msg->delivery_info['delivery_tag'], false);
193-
} else {
193+
} else if ($processFlag !== ConsumerInterface::MSG_ACK_SENT) {
194194
// Remove message from queue only if callback return not false
195195
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
196196
}

RabbitMq/ConsumerInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ interface ConsumerInterface
2626
*/
2727
const MSG_REJECT = -1;
2828

29+
/**
30+
* Flag for consumers that wants to handle ACKs on their own
31+
*/
32+
const MSG_ACK_SENT = -2;
2933

3034
/**
3135
* @param AMQPMessage $msg The message

0 commit comments

Comments
 (0)