All Data Structures Functions Variables Pages
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
JobQueue Class Reference
Inheritance diagram for JobQueue:

Public Member Functions

 add ($jobType, $delay=0, $params=array())
 
 getAll ()
 
 deleteAll ()
 
 processAll ()
 
 isEnabled ()
 
 getQueueJobLabel ()
 
 getQueueJobAgainLabel ()
 
 processByJobTypeAndDelay ($jobType, $delay, MessageLogger $messageLogger)
 
 resolveToAddJobTypeByModelByDateTimeAttribute (RedBeanModel $model, $attributeName, $jobType, $resolveForOldModel=false)
 

Data Fields

const MAX_DELAY_NOISE_IN_SECONDS = 15
 

Protected Member Functions

 isJobTypeWithDelayAndParamsAlreadyExistInQueueAndReplaceItInQueue ($jobType, $delay, $params, $replaceExistingJobInQueueWithLatterOne=false)
 
 isDelayWithinAcceptableTolerance ($existingJobDelay, $delay, $noise)
 

Protected Attributes

 $queuedJobs = array()
 

Detailed Description

Helper class for managing job queues. Override as needed.

Definition at line 40 of file JobQueue.php.

Member Function Documentation

add (   $jobType,
  $delay = 0,
  $params = array() 
)
Parameters
string$jobType
int$delay- seconds to delay job
array$params

Definition at line 51 of file JobQueue.php.

isJobTypeWithDelayAndParamsAlreadyExistInQueueAndReplaceItInQueue (   $jobType,
  $delay,
  $params,
  $replaceExistingJobInQueueWithLatterOne = false 
)
protected

Check if job type already exist in job queue, with same delay and params

Parameters
string$jobType
int$delay
array$params
bool$replaceExistingJobInQueueWithLatterOne
Returns
bool

Definition at line 73 of file JobQueue.php.

isDelayWithinAcceptableTolerance (   $existingJobDelay,
  $delay,
  $noise 
)
protected

Check if new job delay is in bounds of another

Parameters
int$existingJobDelay
int$delay
int$noise
Returns
bool

Definition at line 116 of file JobQueue.php.

processAll ( )

Override if there is processing to complete. see

Definition at line 139 of file JobQueue.php.

isEnabled ( )

Override and toggle as needed.

Returns
bool

Definition at line 147 of file JobQueue.php.

resolveToAddJobTypeByModelByDateTimeAttribute ( RedBeanModel  $model,
  $attributeName,
  $jobType,
  $resolveForOldModel = false 
)

For a given model, and dateTime attribute, resolve to add a job by the job type. The delay is calculated based on the value of the dateTime attribute

Parameters
RedBeanModel$model
$attributeName
$jobType
bool$resolveForOldModelIf job should be resolved to an old model

Definition at line 174 of file JobQueue.php.


The documentation for this class was generated from the following file:
Generated on Thu Jun 4 2020 07:10:49