What's Changed

Schedule API

Concept Temporal Schedules: Reliable, Scalable, and More Flexible than Cron Jobs (blog post)

Example

use Temporal\Client\Schedule;

// Create a Schedule Client

$client = \Temporal\Client\ScheduleClient::create( \Temporal\Client\GRPC\ServiceClient::create('localhost:7233'), );

// Create a Schedule

$handle = $client->createSchedule( Schedule\Schedule::new()->withAction( Schedule\Action\StartWorkflowAction::new('testWorkflow') ->withTaskQueue('testTaskQueue') ->withRetryPolicy(\Temporal\Common\RetryOptions::new()>withMaximumAttempts(3)) ->withHeader(['foo' => 'bar']) ->withWorkflowExecutionTimeout('40m') )->withSpec( Schedule\Spec\ScheduleSpec::new() ->withCronStringList('0 * * * *') // Every hour

), scheduleId: 'testSchedule', );

// Describe the Schedule

$description = $handle->describe();

// Update the Schedule$handle->update( $description->schedule->withSpec( Schedule\Spec\ScheduleSpec::new() ->withCronStringList('0 12 * * 5', '0 12 * * 1') ), conflictToken: $description->conflictToken, // To avoid race condition);

// Pause the Schedule

$handle->pause();

// Trigger the Action to be taken immediately

$handle->trigger(Schedule\Policy\ScheduleOverlapPolicy::CancelOther);

// Delete the Schedule$handle->delete();

Full Changelogv2.7.0-BETA2...v2.7.0-BETA3