Frederick Zhang Frederick Zhang - 1 year ago 403
PHP Question

How to accommodate Amazon FIFO SQS in Laravel queue?

Amazon has announced their new FIFO SQS service and I'd like to use it in Laravel Queue to solve some concurrency issues.

I've created several new queues and changed the configurations. However, I got a

error which says

The request must contain the parameter MessageGroupId.

So I modified the file

public function pushRaw($payload, $queue = null, array $options = [])
$response = $this->sqs->sendMessage(['QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload,
'MessageGroupId' => env('APP_ENV', getenv('APP_ENV'))]);

return $response->get('MessageId');

public function later($delay, $job, $data = '', $queue = null)
$payload = $this->createPayload($job, $data);

$delay = $this->getSeconds($delay);

return $this->sqs->sendMessage([
'QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload, 'DelaySeconds' => $delay,
'MessageGroupId' => env('APP_ENV', getenv('APP_ENV'))

I'm using
as the group ID (it's a single message queue so actually it doesn't matter a lot. I just want everything to be FIFO).

But I'm still getting the same error message. How could I fix it? Any help would be appreciated.

(btw, where has the SDK defined
? I can find a stub for it but I didn't find the detailed implementation)

Answer Source

Apart from the MessageGroupId, it needs a MessageDeduplicationId or enabling content-based deduplication.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download