Skip to content

Commit 210746d

Browse files
authored
Merge pull request #607: Expose Priority
2 parents 62a0128 + d9d69fb commit 210746d

39 files changed

+766
-148
lines changed

.editorconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ trim_trailing_whitespace = true
1212
trim_trailing_whitespace = false
1313

1414
[*.yml]
15-
indent_style = space
15+
indent_size = 2
16+
17+
[*.yaml]
1618
indent_size = 2
1719

1820
[*.json]

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
"psr/log": "^2.0 || ^3.0.2",
3232
"ramsey/uuid": "^4.7.6",
3333
"react/promise": "^2.11",
34-
"roadrunner-php/roadrunner-api-dto": "^1.10.0",
34+
"roadrunner-php/roadrunner-api-dto": "^1.12.0",
3535
"roadrunner-php/version-checker": "^1.0.1",
3636
"spiral/attributes": "^3.1.8",
37-
"spiral/roadrunner": "^2024.3.3 || ^2025.1.1",
37+
"spiral/roadrunner": "^2025.1.0",
3838
"spiral/roadrunner-cli": "^2.6",
39-
"spiral/roadrunner-kv": "^4.3",
40-
"spiral/roadrunner-worker": "^3.6.1",
39+
"spiral/roadrunner-kv": "^4.3.1",
40+
"spiral/roadrunner-worker": "^3.6.2",
4141
"symfony/filesystem": "^5.4.45 || ^6.4.13 || ^7.0",
4242
"symfony/http-client": "^5.4.49 || ^6.4.17 || ^7.0",
4343
"symfony/polyfill-php83": "^1.31.0",
@@ -56,7 +56,7 @@
5656
"composer/composer": "^2.8.4",
5757
"dereuromark/composer-prefer-lowest": "^0.1.10",
5858
"doctrine/annotations": "^1.14.4 || ^2.0.2",
59-
"internal/dload": "^1.1.0",
59+
"internal/dload": "^1.2.0",
6060
"jetbrains/phpstorm-attributes": "dev-master",
6161
"laminas/laminas-code": "^4.16",
6262
"phpunit/phpunit": "10.5.45",

dload.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
temp-dir="./runtime"
55
>
66
<actions>
7-
<download software="rr" version="^2024.3.3"/>
8-
<download software="temporal"/>
7+
<download software="rr" version="^2025.1.0"/>
8+
<download software="temporal" version="^1.3-priority"/>
99
<download software="temporal-tests-server"/>
1010
</actions>
1111
<registry>

src/Activity/ActivityInfo.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use JetBrains\PhpStorm\Immutable;
1717
use Temporal\Activity;
1818
use Temporal\Client\ActivityCompletionClientInterface;
19+
use Temporal\Common\Priority;
1920
use Temporal\Common\Uuid;
2021
use Temporal\Internal\Marshaller\Meta\Marshal;
2122
use Temporal\Internal\Marshaller\Type\DateIntervalType;
@@ -99,6 +100,14 @@ final class ActivityInfo
99100
#[Marshal(name: 'Attempt')]
100101
public int $attempt = 1;
101102

103+
/**
104+
* Return the priority of the activity task.
105+
*
106+
* @internal Experimental API
107+
*/
108+
#[Marshal(name: 'Priority')]
109+
public Priority $priority;
110+
102111
/**
103112
* ActivityInfo constructor.
104113
*/
@@ -112,5 +121,7 @@ public function __construct()
112121
$this->scheduledTime = CarbonImmutable::now();
113122
$this->startedTime = CarbonImmutable::now();
114123
$this->deadline = CarbonImmutable::now();
124+
125+
$this->priority = Priority::new();
115126
}
116127
}

src/Activity/ActivityOptions.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Carbon\CarbonInterval;
1515
use JetBrains\PhpStorm\Pure;
1616
use Temporal\Common\MethodRetry;
17+
use Temporal\Common\Priority;
1718
use Temporal\Common\RetryOptions;
1819
use Temporal\Internal\Marshaller\Meta\Marshal;
1920
use Temporal\Internal\Marshaller\Type\ActivityCancellationType as ActivityCancellationMarshallerType;
@@ -109,6 +110,15 @@ class ActivityOptions extends Options implements ActivityOptionsInterface
109110
#[Marshal(name: 'RetryPolicy', type: NullableType::class, of: RetryOptions::class)]
110111
public ?RetryOptions $retryOptions = null;
111112

113+
/**
114+
* Optional priority settings that control relative ordering of task processing when tasks are
115+
* backed up in a queue.
116+
*
117+
* Defaults to inheriting priority from the workflow that scheduled the activity.
118+
*/
119+
#[Marshal(name: 'Priority')]
120+
public Priority $priority;
121+
112122
/**
113123
* ActivityOptions constructor.
114124
*/
@@ -118,6 +128,7 @@ public function __construct()
118128
$this->scheduleToCloseTimeout = CarbonInterval::seconds(0);
119129
$this->startToCloseTimeout = CarbonInterval::seconds(0);
120130
$this->heartbeatTimeout = CarbonInterval::seconds(0);
131+
$this->priority = Priority::new();
121132

122133
parent::__construct();
123134
}
@@ -291,4 +302,22 @@ public function withRetryOptions(?RetryOptions $options): self
291302

292303
return $self;
293304
}
305+
306+
/**
307+
* Optional priority settings that control relative ordering of task processing when tasks are
308+
* backed up in a queue.
309+
*
310+
* Defaults to inheriting priority from the workflow that scheduled the activity.
311+
*
312+
* @return $this
313+
*
314+
* @internal Experimental
315+
*/
316+
#[Pure]
317+
public function withPriority(Priority $priority): self
318+
{
319+
$self = clone $this;
320+
$self->priority = $priority;
321+
return $self;
322+
}
294323
}

0 commit comments

Comments
 (0)