Skip to content

Commit

Permalink
Workflow inbound interceptor context messages: add isReplaying flag
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Nov 18, 2024
1 parent df36a91 commit b2cdc1a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Interceptor/WorkflowInbound/SignalInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function __construct(
public readonly WorkflowInfo $info,
public readonly ValuesInterface $arguments,
public readonly HeaderInterface $header,
public readonly bool $isReplaying,
) {}

public function with(
Expand All @@ -43,6 +44,7 @@ public function with(
$info ?? $this->info,
$arguments ?? $this->arguments,
$header ?? $this->header,
$this->isReplaying,
);
}
}
2 changes: 2 additions & 0 deletions src/Interceptor/WorkflowInbound/UpdateInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function __construct(
public readonly WorkflowInfo $info,
public readonly ValuesInterface $arguments,
public readonly HeaderInterface $header,
public readonly bool $isReplaying,
) {}

public function with(
Expand All @@ -45,6 +46,7 @@ public function with(
$info ?? $this->info,
$arguments ?? $this->arguments,
$header ?? $this->header,
$this->isReplaying,
);
}
}
2 changes: 2 additions & 0 deletions src/Interceptor/WorkflowInbound/WorkflowInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function __construct(
public readonly WorkflowInfo $info,
public readonly ValuesInterface $arguments,
public readonly HeaderInterface $header,
public readonly bool $isReplaying,
) {}

public function with(
Expand All @@ -39,6 +40,7 @@ public function with(
$info ?? $this->info,
$arguments ?? $this->arguments,
$header ?? $this->header,
$this->isReplaying,
);
}
}
1 change: 1 addition & 0 deletions src/Internal/Transport/Router/InvokeUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function handle(ServerRequestInterface $request, array $headers, Deferred
info: $context->getInfo(),
arguments: $request->getPayloads(),
header: $request->getHeader(),
isReplaying: $context->isReplaying(),
);

// Validation
Expand Down
7 changes: 6 additions & 1 deletion src/Internal/Transport/Router/StartWorkflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ public function handle(ServerRequestInterface $request, array $headers, Deferred
/** @see WorkflowInboundCallsInterceptor::execute() */
'execute',
)(
new WorkflowInput($context->getInfo(), $context->getInput(), $context->getHeader()),
new WorkflowInput(
$context->getInfo(),
$context->getInput(),
$context->getHeader(),
$context->isReplaying(),
),
);
}

Expand Down
1 change: 1 addition & 0 deletions src/Internal/Workflow/Process/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ function (?\Throwable $error): void {
$this->scopeContext->getInfo(),
$arguments,
$this->scopeContext->getHeader(),
$this->scopeContext->isReplaying(),
));
},
);
Expand Down

0 comments on commit b2cdc1a

Please sign in to comment.