-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Temporal support #49
Open
xepozz
wants to merge
16
commits into
Baldinof:2.x
Choose a base branch
from
xepozz:add-temporal-support
base: 2.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
821e4db
Add temporal sdk to composer.json
xepozz 875b404
Rename Worker -> HttpWorker
xepozz 0904f18
Add aliases for another dependencies
xepozz 3249c2f
Add worker resolver and temporal worker implementation
xepozz 972659b
Add configuration for new worker
xepozz 02d538c
Add worker resolver to command and remove redundant test case
xepozz 7a301b3
Improve .gitignore
xepozz 52adfb3
Add configuration for catching workflows and activities
xepozz 4db5a9a
Move temporal sdk to dev requirements
xepozz 87e6de4
Split configuration
xepozz e32fd03
Add example to .rr.yaml file
xepozz b9292c2
Remove unused class
xepozz 54ace14
Adjust workers configuration
xepozz b062bc2
Give back error message
xepozz 34075f4
Add temporal configuration to .rr.dev.yaml
xepozz a239d1e
Give back `public` declaration for workers
xepozz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/vendor | ||
/tests/__cache | ||
/.phpunit.result.cache | ||
.idea | ||
vendor | ||
tests/__cache | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Baldinof\RoadRunnerBundle\Command\WorkerCommand; | ||
use Baldinof\RoadRunnerBundle\DependencyInjection\BaldinofRoadRunnerExtension; | ||
use Baldinof\RoadRunnerBundle\Worker\HttpWorker; | ||
use Baldinof\RoadRunnerBundle\Worker\TemporalWorker; | ||
use Baldinof\RoadRunnerBundle\Worker\WorkerResolver; | ||
use Baldinof\RoadRunnerBundle\Worker\WorkerResolverInterface; | ||
use Spiral\RoadRunner\EnvironmentInterface; | ||
use Temporal\Client\GRPC\ServiceClient; | ||
use Temporal\Client\WorkflowClient; | ||
use Temporal\Client\WorkflowClientInterface; | ||
use Temporal\Worker\WorkerFactoryInterface; | ||
use Temporal\WorkerFactory; | ||
use function function_exists; | ||
|
||
// Polyfill of the `service()` function introduced in Symfony 5.1 when using older version | ||
if (!function_exists('Symfony\Component\DependencyInjection\Loader\Configurator\service')) { | ||
function service(string $id): ReferenceConfigurator | ||
{ | ||
return ref($id); | ||
} | ||
} | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->parameters() | ||
->set('baldinof_road_runner.temporal_address', '127.0.0.1:7233'); | ||
|
||
$services = $container->services(); | ||
|
||
$services | ||
->set(WorkerFactoryInterface::class) | ||
->factory([WorkerFactory::class, 'create']); | ||
|
||
$services | ||
->set(TemporalWorker::class) | ||
->public() // Manually retrieved on the DIC in the Worker if the kernel has been rebooted | ||
->tag('monolog.logger', ['channel' => BaldinofRoadRunnerExtension::MONOLOG_CHANNEL]) | ||
->lazy() | ||
->args([ | ||
service('kernel'), | ||
service(WorkerFactoryInterface::class), | ||
tagged_iterator('baldinof_road_runner.temporal_workflows'), | ||
tagged_iterator('baldinof_road_runner.temporal_activities'), | ||
]); | ||
|
||
$services | ||
->set(WorkerResolverInterface::class, WorkerResolver::class) | ||
->args([ | ||
service(EnvironmentInterface::class), | ||
service(HttpWorker::class), | ||
service(TemporalWorker::class), | ||
]); | ||
|
||
$services | ||
->set(WorkerCommand::class) | ||
->args([ | ||
service(WorkerResolverInterface::class), | ||
service(EnvironmentInterface::class), | ||
]) | ||
->autoconfigure(); | ||
|
||
$services | ||
->set(WorkflowClientInterface::class, WorkflowClient::class) | ||
->args([ | ||
service(ServiceClient::class), | ||
]); | ||
|
||
$services | ||
->set(ServiceClient::class) | ||
->factory([ServiceClient::class, 'create']) | ||
->args([ | ||
param('baldinof_road_runner.temporal_address') | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Baldinof\RoadRunnerBundle\Exception; | ||
|
||
final class UnsupportedRoadRunnerModeException extends \RuntimeException implements ExceptionInterface | ||
{ | ||
public function __construct(string $mode) | ||
{ | ||
$message = sprintf('Could not resolve worker for mode %s', $mode); | ||
parent::__construct($message); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in
services.php