/
index.php
29 lines (18 loc) · 854 Bytes
/
index.php
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
<?php
//Get the set of required files
require_once('bootstrap.php');
use Queue as Queue;
use Database as Database;
$objDB = new Database\Database($dbCredArray); //Get the DB Object
$objProcessQueue = new Queue\ProcessQueue($objDB); //Process Queue need DB for processing
if($objProcessQueue->lockEmailsFromQueue(SERVER_NAME, MAX_MAILS_TO_READ)) {
$emailArray = $objProcessQueue->getLockedEmails(SERVER_NAME);
if(is_array($emailArray) && count($emailArray) > 0) {
foreach($emailArray as $key=>$sendEmailArray) {
//Setup the JSON for the Async Process execution
$asyncParamsJSON = json_encode($sendEmailArray);
//Initiate the Async Process with the configuration required
$objProcessQueue->initiateAsyncThread($asyncConfigArray, 'postValue=' . $asyncParamsJSON);
}
}
}