Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ app/**/temporal.exe
app/tests/**/*.log
app/runtime
app/vendor
app/**/temporal-test-server
.DS_Store
14 changes: 11 additions & 3 deletions app/composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": [
{
"type": "vcs",
"url": "https://github.com/temporalio/sdk-php"
}
],
"require": {
"spiral/tokenizer": "^3.16.0",
"temporal/sdk": "^2.17",
"temporal/sdk": "dev-nexus-new as 2.18.0",
"temporal/open-telemetry-interceptors": "^1.0",
"open-telemetry/exporter-otlp": "^1.3",
"open-telemetry/transport-grpc": "^1.1",
Expand All @@ -12,7 +18,8 @@
"require-dev": {
"buggregator/trap": "^1.15",
"internal/dload": "^1.8.0",
"phpunit/phpunit": "^10.5"
"phpunit/phpunit": "^10.5",
"phpstan/phpstan": "^2.2"
},
"autoload": {
"psr-4": {
Expand All @@ -33,6 +40,7 @@
},
"scripts": {
"get:binaries": "dload get --no-interaction -vv",
"test:feat": "phpunit --testsuite=Feature --color=always --testdox"
"test:feat": "phpunit --testsuite=Feature --color=always --testdox",
"phpstan": "phpstan analyse --memory-limit=2G"
}
}
177 changes: 156 additions & 21 deletions app/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions app/phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
parameters:
level: 6
paths:
- src/Nexus
- src/NexusCancellation
- src/NexusContextPropagation
- src/NexusMultipleArguments
- tests/Feature
excludePaths:
- tests/Feature/worker.log
1 change: 1 addition & 0 deletions app/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<ini name="error_reporting" value="-1"/>
<ini name="memory_limit" value="-1"/>
<env name="TEMPORAL_ADDRESS" value="localhost:7236" force="true"/>
<env name="TEMPORAL_HTTP_PORT" value="7246" force="true"/>
<env name="RR_RPC" value="tcp://127.0.0.1:6006" force="true"/>
</php>
<source>
Expand Down
34 changes: 34 additions & 0 deletions app/src/Interceptors/Interceptor/ExceptionLoggerInterceptor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/**
* This file is part of Temporal package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Temporal\Samples\Interceptors\Interceptor;

use Psr\Log\LoggerInterface;
use React\Promise\PromiseInterface;
use Temporal\Interceptor\WorkflowOutboundRequestInterceptor;
use Temporal\Worker\Transport\Command\RequestInterface;

final class ExceptionLoggerInterceptor implements WorkflowOutboundRequestInterceptor
{
public function __construct(
private readonly LoggerInterface $logger,
) {}

public function handleOutboundRequest(RequestInterface $request, callable $next): PromiseInterface
{
try {
return $next($request);
} catch (\Throwable $e) {
$this->logger->error($e->getMessage(), ['exception' => $e]);
throw $e;
}
}
}
16 changes: 16 additions & 0 deletions app/src/Nexus/.rr.caller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3"

rpc:
listen: tcp://127.0.0.1:6102

server:
command: "php caller-worker.php"

temporal:
address: ${TEMPORAL_HOST:-localhost}:${TEMPORAL_PORT:-7233}
namespace: ${TEMPORAL_NAMESPACE:-my-caller-namespace}
activities:
num_workers: 2

logs:
level: info
16 changes: 16 additions & 0 deletions app/src/Nexus/.rr.handler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3"

rpc:
listen: tcp://127.0.0.1:6101

server:
command: "php handler-worker.php"

temporal:
address: ${TEMPORAL_HOST:-localhost}:${TEMPORAL_PORT:-7233}
namespace: ${TEMPORAL_NAMESPACE:-my-target-namespace}
activities:
num_workers: 2

logs:
level: info
Loading