Polyscope - The agent-first dev environment for Laravel

Laravel Sqs Fifo Queue

shiftonelabs/laravel-sqs-fifo-queue image

Laravel Sqs Fifo Queue stats

Downloads
2.2M
Stars
137
Open Issues
1
Forks
58

View on GitHub →

Adds a Laravel queue driver for Amazon SQS FIFO queues.

Summary of Laravel SQS FIFO Queue Package

The laravel-sqs-fifo-queue package provides a specialized queue driver for handling Amazon SQS FIFO (First In, First Out) queues within Laravel and Lumen applications. Unlike standard SQS queues, FIFO queues ensure that messages are processed exactly once and in the order they are sent. This package seamlessly integrates these queues into the Laravel framework, which natively supports only standard SQS queues.

Key Features

  • SQS FIFO Support: Enables the use of SQS FIFO queues, which are not natively supported by Laravel.
  • Message Grouping: Supports multiple message groups within a single FIFO queue to optimize performance and order.
  • Deduplication Configuration: Offers configurable deduplication strategies (unique, content, or relying on SQS's built-in capabilities).
  • Environment Specific Suffix: Allows dynamic queue naming based on the environment, aiding simpler configuration across development, staging, and production.
  • Transaction-aware Dispatching: Option to delay job dispatch until after database transactions commit, ensuring data consistency.
  • Integration with Laravel Job Batching: Ensures FIFO queue compatibility with Laravel's job batching features.

Installation and Configuration

Install via Composer:

composer require shiftonelabs/laravel-sqs-fifo-queue

For Laravel, no additional service provider registration is needed due to package auto-discovery. For Lumen, manual registration is required in bootstrap/app.php.

Configuration involves setting up the queue.php config file with appropriate credentials and queue details:

'sqs-fifo' => [
'driver' => 'sqs-fifo',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_FIFO_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_FIFO_QUEUE', 'default.fifo'),
'suffix' => env('SQS_FIFO_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'group' => 'default',
'deduplicator' => env('SQS_FIFO_DEDUPLICATOR', 'unique'),
'allow_delay' => env('SQS_FIFO_ALLOW_DELAY', false),
],

Usage

Utilize the FIFO queue just like any standard Laravel queue. The package handles specifics such as message grouping and deduplication internally. Jobs can be dispatched to different message groups or use different deduplication strategies by using provided methods like onMessageGroup() and withDeduplicator().

Advanced Configuration

The package allows for advanced customization including per-job group settings, custom deduplication logic, and handling of delayed jobs in a FIFO context (note that FIFO supports only queue-wide delay settings).

Conclusion

The laravel-sqs-fifo-queue package is an essential tool for developers needing reliable and ordered processing of jobs in a Laravel application, leveraging the advanced features of Amazon SQS FIFO queues. It simplifies integration and usage while providing powerful options for performance tuning and customization.

shiftonelabs photo

Shift One Labs is a web application development company specializing in both customizing existing applications and developing new ones.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Shiftonelabs Laravel Sqs Fifo Queue Related Articles

Cache Failover and Deferred Queue in Laravel 12.35 image

Cache Failover and Deferred Queue in Laravel 12.35

Read article
Use Amazon's new Fair Queue Feature With SQS in Laravel 12.27 image

Use Amazon's new Fair Queue Feature With SQS in Laravel 12.27

Read article
Using SQS FIFO Queues image

Using SQS FIFO Queues

Read article
Blastup logo

Blastup

Blastup provides social media enhancement services including buying Instagram likes, followers, and views, with features like instant delivery and a variety of packages to suit different needs.

Blastup
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
CodeKudu logo

CodeKudu

Stand-ups, Retrospectives, and 360° Feedback for the entire team. 50% off with code LARAVELNEWS.

CodeKudu