KMP PHP API Reference

PlatformScheduleRunner
in package

Table of Contents

Constants

SCOPE_ALL_ACTIVE_TENANTS  : mixed = 'all_active_tenants'
SCOPE_PLATFORM  : mixed = 'platform'
SCOPE_SINGLE_TENANT  : mixed = 'single_tenant'
VALID_SCOPES  : array<int, string> = [self::SCOPE_PLATFORM, self::SCOPE_ALL_ACTIVE_T...

Properties

$dispatcher  : PlatformScheduleDispatcherInterface|null
$tenantConnectionManager  : TenantConnectionManager|null

Methods

__construct()  : mixed
Constructor.
run()  : array<string, int|string>
Run an enabled platform schedule by name.
runDue()  : array{schedules: int, completed: int, failed: int, jobsCreated: int}
Run schedules that are due, using advisory locks to prevent duplicate dispatch.
scrubError()  : string
Redact sensitive values from an error before storing it in platform_jobs.
acquireLock()  : bool
Acquire the PostgreSQL advisory lock for a due schedule.
activeTenants()  : array<int, TenantMetadata>
dispatchTarget()  : int
failFast()  : bool
Whether a tenant fan-out schedule should stop after the first target failure.
findSchedule()  : array<string, mixed>|null
getDispatcher()  : PlatformScheduleDispatcherInterface
Resolve the command dispatcher.
isTruthy()  : bool
Normalize database truthy values across PostgreSQL/SQLite test doubles.
jobParameters()  : array<string, string>
markScheduleStarted()  : void
normalizeJson()  : array<int, mixed>|array<string, mixed>
normalizeSchedule()  : array<string, mixed>
now()  : DateTime
Return the current timestamp.
recordEmptyRuns()  : bool
Whether a successful schedule target with no activity should be retained.
releaseLock()  : void
Release the PostgreSQL advisory lock for a schedule.
resolveTargets()  : array<int, TenantMetadata|null>
runTarget()  : array{status: string, lastError: string|null, jobRecorded: bool}
singleTenant()  : TenantMetadata

Constants

VALID_SCOPES

private array<int, string> VALID_SCOPES = [self::SCOPE_PLATFORM, self::SCOPE_ALL_ACTIVE_TENANTS, self::SCOPE_SINGLE_TENANT]

Properties

Methods

run()

Run an enabled platform schedule by name.

public run(string $name) : array<string, int|string>
Parameters
$name : string

Schedule name

Return values
array<string, int|string>

runDue()

Run schedules that are due, using advisory locks to prevent duplicate dispatch.

public runDue([int $limit = 100 ]) : array{schedules: int, completed: int, failed: int, jobsCreated: int}
Parameters
$limit : int = 100
Return values
array{schedules: int, completed: int, failed: int, jobsCreated: int}

scrubError()

Redact sensitive values from an error before storing it in platform_jobs.

public static scrubError(string $message) : string
Parameters
$message : string

Error message

Return values
string

acquireLock()

Acquire the PostgreSQL advisory lock for a due schedule.

private acquireLock(string $lockKey) : bool
Parameters
$lockKey : string
Return values
bool

dispatchTarget()

private dispatchTarget(array<string, mixed> $schedule, TenantMetadata|null $tenant) : int
Parameters
$schedule : array<string, mixed>

Schedule row

$tenant : TenantMetadata|null

Tenant target

Return values
int

Number of work items processed or dispatched

failFast()

Whether a tenant fan-out schedule should stop after the first target failure.

private failFast(array<string, mixed> $schedule) : bool
Parameters
$schedule : array<string, mixed>

Schedule row

Return values
bool

findSchedule()

private findSchedule(string $name) : array<string, mixed>|null
Parameters
$name : string
Return values
array<string, mixed>|null

isTruthy()

Normalize database truthy values across PostgreSQL/SQLite test doubles.

private isTruthy(mixed $value) : bool
Parameters
$value : mixed

Value to check

Return values
bool

jobParameters()

private jobParameters(array<string, mixed> $schedule) : array<string, string>
Parameters
$schedule : array<string, mixed>

Schedule row

Return values
array<string, string>

markScheduleStarted()

private markScheduleStarted(array<string, mixed> $schedule, DateTime $now) : void
Parameters
$schedule : array<string, mixed>

Schedule row

$now : DateTime

Start time

normalizeJson()

private normalizeJson(mixed $value) : array<int, mixed>|array<string, mixed>
Parameters
$value : mixed
Return values
array<int, mixed>|array<string, mixed>

normalizeSchedule()

private normalizeSchedule(array<string, mixed> $row) : array<string, mixed>
Parameters
$row : array<string, mixed>

Schedule row

Return values
array<string, mixed>

recordEmptyRuns()

Whether a successful schedule target with no activity should be retained.

private recordEmptyRuns(array<string, mixed> $schedule) : bool
Parameters
$schedule : array<string, mixed>

Schedule row

Return values
bool

releaseLock()

Release the PostgreSQL advisory lock for a schedule.

private releaseLock(string $lockKey) : void
Parameters
$lockKey : string

runTarget()

private runTarget(array<string, mixed> $schedule, TenantMetadata|null $tenant) : array{status: string, lastError: string|null, jobRecorded: bool}
Parameters
$schedule : array<string, mixed>

Schedule row

$tenant : TenantMetadata|null

Tenant target

Return values
array{status: string, lastError: string|null, jobRecorded: bool}
On this page

Search results