summaryrefslogtreecommitdiff
path: root/tests/temporal/Workflow/CanceledHeartbeatWorkflow.php
blob: 6b463192f77b38994797c700d9dc209395f29e67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

declare(strict_types=1);

namespace Temporal\Tests\Workflow;

use Temporal\Activity\ActivityCancellationType;
use Temporal\Activity\ActivityOptions;
use Temporal\Workflow;
use Temporal\Workflow\WorkflowMethod;
use Temporal\Tests\Activity\HeartBeatActivity;

#[Workflow\WorkflowInterface]
class CanceledHeartbeatWorkflow
{
    #[WorkflowMethod(name: 'CanceledHeartbeatWorkflow')]
    public function handler(): iterable
    {
        $act = Workflow::newActivityStub(
            HeartBeatActivity::class,
            ActivityOptions::new()
                ->withStartToCloseTimeout(50)
                ->withCancellationType(ActivityCancellationType::WAIT_CANCELLATION_COMPLETED)
                ->withHeartbeatTimeout(1)
        );

        return yield $act->slow('test');
    }
}