Thumper icon indicating copy to clipboard operation
Thumper copied to clipboard

Handle failures and retries?

Open ebeyrent opened this issue 12 years ago • 6 comments

I can't see a way in this library to reject a message in the callback upon some error condition so that RabbitMQ will retry the message.

Am I missing something, or should I be using php-amqplib instead?

ebeyrent avatar Jan 14 '13 18:01 ebeyrent

Rejecting messages is not implemented in this library.

videlalvaro avatar Jan 14 '13 19:01 videlalvaro

The ack message is actually sent by the Consumer class right after call_user_func so there is no proper way for a callback to reject or nack the message expect throw an ugly exception.

Solution can be to pass the $msg->delivery_info to the callback action and:

  • let it do the ack / nack / reject
  • do an ack call in Consumer if the callback hasn't send anything.

bastnic avatar Jan 17 '13 15:01 bastnic

I'd like to be able to implement some sort of dead-letter queue if the callback returns false.

ebeyrent avatar Jan 18 '13 01:01 ebeyrent

I've created a new PHP library called Mopsy, loosely based on Thumper. It provides functionality for retrying failed messaged based on a configurable threshold, and beyond that republishes the message to a dead-letter exchange.

https://github.com/ebeyrent/Mopsy

ebeyrent avatar Feb 06 '13 18:02 ebeyrent

cool stuff

videlalvaro avatar Feb 06 '13 19:02 videlalvaro

@videlalvaro would you recommend just extending the Thumper\Consumer and implementing our own processMessage method? seems like the most reasonable approach?

andrefigueira avatar Jun 12 '17 09:06 andrefigueira