-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaws_sqs.module
67 lines (56 loc) · 1.39 KB
/
aws_sqs.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* @file
* AWS SQS module functions.
*/
/**
* Implements hook_menu().
*/
function aws_sqs_menu() {
$items['admin/config/system/aws-queue'] = array(
'route_name' => 'aws_sqs.settings',
'title' => 'Amazon SQS Settings',
'description' => 'Configure your Amazon SQS Settings.',
);
return $items;
}
/**
* Implements hook_queue_info().
*
* This hook is used by queue_ui (and other modules)
* to discover non SystemQueue based queues.
*/
function aws_sqs_queue_info() {
// Import variables from settings.php
global $conf;
$queues = array();
$blacklist = array(
'aws_sqs_default_queue',
'aws_sqs_aws_key',
'aws_sqs_aws_secret',
'aws_sqs_region',
'aws_sqs_waittimeseconds',
'aws_sqs_enable',
);
foreach(variable_initialize($conf) as $key => $value) {
if (substr($key, 0, 7) == 'aws_sqs' && !in_array($key, $blacklist)) {
$name = substr($key, 8);
$queues[$name] = array('title' => str_replace('_', ' ', $name));
}
}
return $queues;
}
/*function aws_sqs_test() {
// initialize the queue
$queue = Drupal::queue('update_fetch_tasks');
// 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();
$queue->deleteItem($item);
//drush_print_r($item);
}*/