github durable-workflow/workflow 0.0.35

latest releases: 1.0.70, 1.0.69, 1.0.68...
2 years ago

Adds sagas.

class SagaWorkflow extends Workflow
{
    public function execute()
    {
        try {
            yield ActivityStub::make(SimpleActivity::class);
            $this->addCompensation(fn () => ActivityStub::make(SimpleUndoActivity::class));

            yield ActivityStub::make(SimpleOtherActivity::class, 'other');
            $this->addCompensation(fn () => ActivityStub::make(SimpleUndoOtherActivity::class, 'other'));
        } catch (Throwable $th) {
            yield from $this->compensate();
            throw $th;
        }

        return 'workflow';
    }
}

Don't miss a new workflow release

NewReleases is sending notifications on new releases.