47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
#!/usr/local/bin/php
|
|
<?php
|
|
/******************************************
|
|
* Author : Riccardo Di Dato
|
|
* Created On : Tue Sep 22 2020
|
|
* File : processJobs.php
|
|
*******************************************/
|
|
|
|
use ASD\Context;
|
|
use ASD\DB\DaoRegistry;
|
|
use ASD\Job\JobExecutor;
|
|
use ASD\Job\LocalFilesystemComunicationStrategy;
|
|
use ASD\Job\LogManagerLoggingStrategy;
|
|
use ASD\Job\MongoJobStorageClass;
|
|
use ASD\Job\RunnableJobFactory;
|
|
use ASD\Job\SingleJobExecutionStrategy;
|
|
|
|
$buildName = getenv("ASD_BUILDNAME");
|
|
require_once ("/home/asdynamics/private/$buildName/load.php");
|
|
|
|
try{
|
|
|
|
$jobFactory = new RunnableJobFactory();
|
|
|
|
|
|
$storageClass = new MongoJobStorageClass(DaoRegistry::getDefaultMongo(), $jobFactory);
|
|
$comStrategy = new LocalFilesystemComunicationStrategy(
|
|
Context::getEnvironment()->getFilePath("comunication.shutdown"),
|
|
Context::getEnvironment()->getFilePath("comunication.execution"),
|
|
Context::getEnvironment()->getFilePath("comunication.idle")
|
|
);
|
|
$execStrat = new SingleJobExecutionStrategy();
|
|
$logStrategy = new LogManagerLoggingStrategy("job");
|
|
|
|
$executor = new JobExecutor($storageClass, $comStrategy, $execStrat, $logStrategy );
|
|
$executor->run();
|
|
exit(0);
|
|
}
|
|
catch (Exception $ex) {
|
|
var_dump($ex);
|
|
exit(1);
|
|
}
|
|
|
|
|
|
|
|
?>
|