abstract class Job implements SerializableInterface

Traits

Properties

protected callable $statusUpdateCallback

Callback tor status updates

array $_constructArgs

todo private, then reflection in create

Methods

static object
create(...$args)

No description

bool
execute(QueueableJob $queueableJob = null)

Execute is your primary job execution function

bool
executeInJobQueue(QueueableJob $queueableJob)

When execute is called from Queue an additional QueueableJob Object is passed to execute

static JobStatus|null
getStatus(string $uniqueId)

Get the status of your job

array
jsonSerialize()

No description

void
onAbort()

Note: This event always is being triggered by the job runner

void
onCancel()

Note: This event always is being triggered by the job runner

void
onFinish()

Note: This event always is being triggered by the job runner

void
onRetry()

Note: This event always is being triggered by the job runner

void
onScheduled()

Note: This event may happen in the Frontend call

void
onSerialize()

not used actively - tbd

void
onUnserialize()

Optional: Called after unserialize (e.g. load from db / recover or connect resource)

array|null
serializePropertiesInclude()

Optional: Override this method and specify the properties to include during serialize null = All Properties will be serialized (default) [] = No Properties will be serialized ['id'] = $this->id will be serialized

setStatusUpdateCallback(callable $callback)

Sets the callback which should be called if the job needs to update its status As the QueueableJob has no context of the job itself this function is only available from within the execution context (daemon)

static object
unserializeObject(SerializedObjectHelper $SerializedObjectHelper)

No description

static object
unserializeObjectFromJSON(string $json)

No description

updateStatusMessage(string $messageToken, int|null $progress = null)

Updates the status message for this job which is being shown in user output (can only be used in execute() function)

bool
validate()

If the return is false, the job will not be executed.

Details

at line 28
final static object create(...$args)

No description

Parameters

...$args

Return Value

object

See also

\XELOS\Framework\Module\Infrastructure\Job\static::__construct()

at line 70
abstract bool execute(QueueableJob $queueableJob = null)

Execute is your primary job execution function

Parameters

QueueableJob $queueableJob

Return Value

bool

True indicates a successful run of your job | false will lead to abort or retry when used as QueueableJob

at line 79
bool executeInJobQueue(QueueableJob $queueableJob)

When execute is called from Queue an additional QueueableJob Object is passed to execute

Parameters

QueueableJob $queueableJob

Return Value

bool

at line 162
static JobStatus|null getStatus(string $uniqueId)

Get the status of your job

Parameters

string $uniqueId

Return Value

JobStatus|null

array jsonSerialize()

No description

Return Value

array

Exceptions

ReflectionException

at line 144
void onAbort()

Note: This event always is being triggered by the job runner

Return Value

void

at line 151
void onCancel()

Note: This event always is being triggered by the job runner

Return Value

void

at line 130
void onFinish()

Note: This event always is being triggered by the job runner

Return Value

void

at line 137
void onRetry()

Note: This event always is being triggered by the job runner

Return Value

void

at line 123
void onScheduled()

Note: This event may happen in the Frontend call

Return Value

void

at line 57
void onSerialize()

not used actively - tbd

Return Value

void

void onUnserialize()

Optional: Called after unserialize (e.g. load from db / recover or connect resource)

Return Value

void

SerializedObjectHelper serializeObject()

No description

protected array|null serializePropertiesInclude()

Optional: Override this method and specify the properties to include during serialize null = All Properties will be serialized (default) [] = No Properties will be serialized ['id'] = $this->id will be serialized

Return Value

array|null

at line 104
setStatusUpdateCallback(callable $callback)

Sets the callback which should be called if the job needs to update its status As the QueueableJob has no context of the job itself this function is only available from within the execution context (daemon)

Parameters

callable $callback

static object unserializeObject(SerializedObjectHelper $SerializedObjectHelper)

No description

Parameters

SerializedObjectHelper $SerializedObjectHelper

Return Value

object

Exceptions

ReflectionException

static object unserializeObjectFromJSON(string $json)

No description

Parameters

string $json

Return Value

object

Exceptions

JsonException
ReflectionException

at line 89
protected updateStatusMessage(string $messageToken, int|null $progress = null)

Updates the status message for this job which is being shown in user output (can only be used in execute() function)

Parameters

string $messageToken
int|null $progress

If given will indicate the progress of this job, should be 0-100

at line 113
bool validate()

If the return is false, the job will not be executed.

Return Value

bool