File tree Expand file tree Collapse file tree 4 files changed +75
-1
lines changed
Expand file tree Collapse file tree 4 files changed +75
-1
lines changed Original file line number Diff line number Diff line change 12021202 $request = new SignalExternalWorkflow(
12031203 $this->getOptions()->namespace,
12041204 $execution->getID(),
1205- $execution->getRunID() ,
1205+ null ,
12061206 $name,
12071207 EncodedValues::fromValues($args),
12081208 true,
Original file line number Diff line number Diff line change 1818use Temporal \Internal \Support \DateInterval ;
1919use Temporal \Worker \WorkerFactoryInterface ;
2020use Temporal \Worker \Worker ;
21+ use Temporal \Workflow ;
2122
2223/**
2324 * @psalm-import-type DateIntervalValue from DateInterval
@@ -55,6 +56,12 @@ public function __construct()
5556 {
5657 $ this ->workflowRunTimeout = CarbonInterval::seconds (0 );
5758 $ this ->workflowTaskTimeout = CarbonInterval::seconds (0 );
59+ try {
60+ // Inherit TaskQueue from the current Workflow if possible
61+ $ this ->taskQueue = Workflow::getInfo ()->taskQueue ;
62+ } catch (\Throwable ) {
63+ // Do nothing
64+ }
5865 }
5966
6067 /**
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * This file is part of Temporal package.
5+ *
6+ * For the full copyright and license information, please view the LICENSE
7+ * file that was distributed with this source code.
8+ */
9+
10+ declare (strict_types=1 );
11+
12+ namespace Temporal \Tests \Workflow ;
13+
14+ use Temporal \Activity \ActivityOptions ;
15+ use Temporal \Tests \Activity \SimpleActivity ;
16+ use Temporal \Workflow ;
17+ use Temporal \Workflow \WorkflowMethod ;
18+
19+ #[Workflow \WorkflowInterface]
20+ class ContinuaWithTaskQueueWorkflow
21+ {
22+ #[WorkflowMethod(name: 'ContinuaWithTaskQueueWorkflow ' )]
23+ public function handler (
24+ int $ generation
25+ ) {
26+ $ simple = Workflow::newActivityStub (
27+ SimpleActivity::class,
28+ ActivityOptions::new ()->withStartToCloseTimeout (5 )
29+ );
30+
31+ if ($ generation > 5 ) {
32+ // complete
33+ return Workflow::getInfo ()->taskQueue . $ generation ;
34+ }
35+
36+ if ($ generation !== 1 ) {
37+ assert (!empty (Workflow::getInfo ()->continuedExecutionRunId ));
38+ }
39+
40+ for ($ i = 0 ; $ i < $ generation ; $ i ++) {
41+ yield $ simple ->echo ((string )$ generation );
42+ }
43+
44+ return Workflow::newContinueAsNewStub (self ::class)->handler (++$ generation );
45+ }
46+ }
Original file line number Diff line number Diff line change 66
77use Temporal \Client \GRPC \ServiceClient ;
88use Temporal \Client \WorkflowClient ;
9+ use Temporal \Client \WorkflowOptions ;
10+ use Temporal \Tests \Workflow \ContinuableWorkflow ;
11+ use Temporal \Tests \Workflow \ContinuaWithTaskQueueWorkflow ;
912use Temporal \Tests \Workflow \NamedArguments \ContinueAsNewNamedArgumentsWorkflow ;
1013use Temporal \Tests \Workflow \NamedArguments \ExecuteChildNamedArgumentsWorkflow ;
1114use Temporal \Tests \Workflow \NamedArguments \ActivityNamedArgumentsWorkflow ;
@@ -213,6 +216,24 @@ public function testContinueAsNewNamedArguments()
213216 ], $ result );
214217 }
215218
219+ /**
220+ * TaskQueue must be inherited from the parent workflow
221+ */
222+ public function testContinueAsNewTaskQueue (): void
223+ {
224+ $ workflow = $ this ->workflowClient ->newWorkflowStub (
225+ ContinuaWithTaskQueueWorkflow::class,
226+ WorkflowOptions::new ()->withTaskQueue ('FooBar ' ),
227+ );
228+
229+ $ result = $ this ->workflowClient ->start (
230+ $ workflow ,
231+ generation: 1 ,
232+ )->getResult ();
233+
234+ self ::assertSame ('FooBar6 ' , $ result );
235+ }
236+
216237 public function testExecuteChildNamedArguments ()
217238 {
218239 $ this ->markTestSkipped (
You can’t perform that action at this time.
0 commit comments