Skip to content

Commit

Permalink
move bridge params to the package
Browse files Browse the repository at this point in the history
  • Loading branch information
xepozz committed Dec 14, 2024
1 parent dc0a030 commit f6de929
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
28 changes: 25 additions & 3 deletions config/di-temporal.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

declare(strict_types=1);

use Temporal\Client\GRPC\ServiceClient;
use Temporal\Client\GRPC\ServiceClientInterface;
use Temporal\Client\WorkflowClient;
use Temporal\Client\WorkflowClientInterface;
use Temporal\DataConverter\DataConverter;
use Temporal\DataConverter\DataConverterInterface;
use Temporal\Worker\Transport\Goridge;
Expand All @@ -10,6 +14,7 @@
use Temporal\Worker\Transport\RPCConnectionInterface;
use Temporal\Worker\WorkerFactoryInterface;
use Temporal\WorkerFactory;
use Yiisoft\Definitions\Reference;
use Yiisoft\Yii\Runner\RoadRunner\Temporal\TemporalDeclarationProvider;

/**
Expand All @@ -22,11 +27,28 @@
}

return [
DataConverterInterface::class => fn () => DataConverter::createDefault(),
RPCConnectionInterface::class => fn () => Goridge::create(),
DataConverterInterface::class => DataConverter::class,
DataConverter::class => fn () => DataConverter::createDefault(),

RPCConnectionInterface::class => Goridge::class,
Goridge::class => fn () => Goridge::create(),

WorkerFactoryInterface::class => WorkerFactory::class,
WorkerFactory::class => fn () => WorkerFactory::create(),
HostConnectionInterface::class => fn () => RoadRunner::create(),

HostConnectionInterface::class => RoadRunner::class,
RoadRunner::class => fn () => RoadRunner::create(),

WorkflowClientInterface::class => WorkflowClient::class,
WorkflowClient::class => [
'class' => WorkflowClient::class,
'__construct()' => [
Reference::to(ServiceClientInterface::class),
],
],

ServiceClientInterface::class => ServiceClient::class,
ServiceClient::class => fn () => ServiceClient::create($temporalParams['host']),

TemporalDeclarationProvider::class => fn () => new TemporalDeclarationProvider(
$temporalParams['workflows'] ?? [],
Expand Down
1 change: 1 addition & 0 deletions config/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
],
'temporal' => [
'enabled' => false,
'host' => 'localhost:7233',
'workflows' => [],
'activities' => [],
],
Expand Down

0 comments on commit f6de929

Please sign in to comment.