Download the PHP package coinvestor/laravel-batchsqs without Composer
On this page you can find all versions of the php package coinvestor/laravel-batchsqs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download coinvestor/laravel-batchsqs
More information about coinvestor/laravel-batchsqs
Files in coinvestor/laravel-batchsqs
Package laravel-batchsqs
Short Description An alternative Amazon SQS queue driver for Laravel. Messages are sent in batches rather than one at a time, which may be more efficient if you have a lot of messages to send.
License MIT
Informations about the package laravel-batchsqs
Laravel-BatchSQS
SQS queue connector for Laravel which sends messages in batches.
Installation
To install:
composer require coinvestor/laravel-batchsqs
Then to publish config files:
artisan vendor:publish
(select the BatchSQSProvider option when prompted)
Usage
This package provides a queue connector called batch-sqs
. Create a block inside connections
as usual:
You can use all of the usual Laravel SQS queue config options. In addition, you can set batch_size
to define how many messages
will be included in each batch (once the batch is full, the messages will be released to the queue).
When the queue object is destroyed (e.g. at the end of the request lifecycle, when Laravel is shutting down), messages which are still waiting to be sent to the queue will be sent, even if the batch size limit has not been reached.
Modifying messages before release
When a batch of messages is released to the queue, CoInvestor\BatchSQS\Queues\Events\BatchMessageReleasingEvent
is dispatched.
To modify each message before it reaches the queue, simply define a listener which will inspect the message and then return
an array which will be merged with the message before it is released:
Flushing the queue
You may wish to send batches to your queues before they are full, or discard them entirely. Here's how: