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';
}
}