I'm wondering if it is possible to manually Ack or Reject message from the RabbitMQ within the Magento 2 consumer process? What is the default behavior?
Let's take first the case of
vendor/magento/framework-message-queue/Consumer.php (this is the consumer instance used by most M2 OOTB consumers). Check the method
process() and from it go to method
Within this method, the class
vendor/magento/framework-amqp/Queue.php is called when using
reject() (in their definition you will find as expected the
In the case of
vendor/magento/framework-message-queue/BatchConsumer.php, if you go down the line, you will find usages of the
vendor/magento/framework-message-queue/MessageStatusProcessor.php class with its
rejectMessages() which again point back to the
vendor/magento/framework-amqp/Queue.php as described above.
So in conclusion, Magento already uses both mechanisms, depending on a specific logic. Check the methods mentioned above to get a grasp on when each is used.