diff options
Diffstat (limited to 'tests/temporal/Workflow/FailedHeartbeatWorkflow.php')
-rw-r--r-- | tests/temporal/Workflow/FailedHeartbeatWorkflow.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/temporal/Workflow/FailedHeartbeatWorkflow.php b/tests/temporal/Workflow/FailedHeartbeatWorkflow.php new file mode 100644 index 00000000..e857f100 --- /dev/null +++ b/tests/temporal/Workflow/FailedHeartbeatWorkflow.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +namespace Temporal\Tests\Workflow; + +use Temporal\Activity\ActivityOptions; +use Temporal\Common\RetryOptions; +use Temporal\Workflow; +use Temporal\Workflow\WorkflowMethod; +use Temporal\Tests\Activity\HeartBeatActivity; + +#[Workflow\WorkflowInterface] +class FailedHeartbeatWorkflow +{ + #[WorkflowMethod(name: 'FailedHeartbeatWorkflow')] + public function handler( + int $iterations + ): iterable { + $act = Workflow::newActivityStub( + HeartBeatActivity::class, + ActivityOptions::new() + ->withStartToCloseTimeout(50) + // will fail on first attempt + ->withRetryOptions(RetryOptions::new()->withMaximumAttempts(2)) + ); + + return yield $act->failedActivity($iterations); + } +} |