This module is a very lightweight implementation of the Amazon Simple Queue System.
It supports all the Drupal Queue parameters and uses a library to take the heavy weight away from the module.
How to use.
Drupal 8
- Download module and enable.
- Make sure aws-sdk-php is installed.
composer require aws/aws-sdk-php
Use module by service.
// Get SQS service.
$sqs_service = \Drupal::service('aws_sqs.queue_factory');
// Get/create queue of given name.
$example_queue = $sqs_service->get('example_queue');
// create data.
$item = array('test', '1', '2', '3');
$example_queue->createItem($item);
// Claim data.
$item = $example_queue->claimItem();
Set default queue to AWS SQS for all queues.
Add following code in settings.php.
$settings['queue_default'] = 'aws_sqs.queue_factory'
$example_queue = \Drupal::queue("example_queue")
Drupal 7
Required : Composer manager
Recommended : Queue Runner
Enable both modules and download the required libraries
drush en composer_manager
drush en aws_sqs
drush composer-rebuild-file
drush composer-execute update
Once the libraries are installed we can proceed and configure the module
- go to admin/config/system/aws-queue and configure your AWS credentials. These credentials can be found at https://portal.aws.amazon.com/gp/aws/securityCredentials under Access Keys
- If you want to replace all Drupal queue systems with the amazon queue you can check the checkbox in the admin page but this is not required.
See code snippet below on how to use this module
// initialize the queue
$queue = new awsSqsQueue('aws_test', 'us-east-2');
// Create the queue
$queue->createQueue();
// Get some data
$item = array('test', '1', '2', '3');
// Add the data to the queue
$queue->createItem($item);
// Fetch the item from the queue
$item = $queue->claimItem();
If you decide to move all your queues to Amazon platform and check the checkbox
you can use the following code
// initialize the queue
$queue = DrupalQueue::get('aws_test');
// Create the queue
$queue->createQueue();
// Get some data
$item = array('test', '1', '2', '3');
// Add the data to the queue
$queue->createItem($item);
// fetch the item from the queue
$item = $queue->claimItem();
Project information
- Module categories: Performance
- 94 sites report using this module
- Created by Nick_vh on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 7.x-1.x-dev updated 21 Dec 2015 at 01:33 UTC