-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Description
I would like to be able to peek at a few failed messages using the messenger:failed:show
command but can't because \Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\AmazonSqsTransport
does not implement \Symfony\Component\Messenger\Transport\Receiver\ListableReceiverInterface
.
Amazon SQS has a receiveMessage
endpoint but it does not allow free listing or searching through messages, it can only return up to 10 oldest messages, without pagination. Therefore, the only options are:
- traversing the queue by taking items off and then putting them back at the end
- not bothering with getting more than 10 items
Option 1 is quite hacky and would interfere with other processes trying to access the queue so I wouldn't do it. Option 2 is only a partial implementation of the interface but would still be useful.
I can write the implementation but I'd like to get approval on the ticket first.
Example
class AmazonSqsReceiver implements /*...*/ ListableReceiverInterface
{
private const MAX_RECEIVE_MESSAGES = 10;
/*...*/
public function all($limit = self::MAX_RECEIVE_MESSAGES): iterable
{
return $this->connection->peek($limit); // Would need to add a method like that, sending requests to the receiveMessage endpoint with VisibilityTimeout=0
}
}