Skip to content

Conversation

yann-eugone
Copy link
Contributor

@yann-eugone yann-eugone commented Apr 29, 2024

At the moment, the job launcher is "guessed", based on what packages are installed

$launchers = [
'yokai_batch.job_launcher.dispatch_message' => $this->installed('symfony-messenger'),
'yokai_batch.job_launcher.run_command' => $this->installed('symfony-console'),
];
$container->setAlias(
JobLauncherInterface::class,
\array_keys(\array_filter($launchers))[0] ?? 'yokai_batch.job_launcher.simple'
);
$container->registerAliasForArgument('yokai_batch.logger', LoggerInterface::class, 'yokaiBatchLogger');

This lead to unexpected behavior for users trying to install the package #118

It was something on my mind for some time now, as I suggested :

This PR covers these 3 issue, proposing the following config tree for the job launchers

yokai_batch:
    launcher:
        default: simple
        launchers:
          simple: simple://simple
          messenger: messenger://messenger
          console: console://console?log=batch_execute.log
          service: service://service?service=app.job_launcher.service

We will have a default job launcher, and many job launcher, that can all be configured and autowired in the same app.

@yann-eugone yann-eugone requested a review from J-Ben87 April 29, 2024 10:27
Copy link

codecov bot commented Apr 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.68%. Comparing base (12de1d5) to head (38c2541).
Report is 3 commits behind head on 0.x.

Additional details and impacted files
@@            Coverage Diff            @@
##                0.x     #121   +/-   ##
=========================================
  Coverage     99.67%   99.68%           
- Complexity      844      858   +14     
=========================================
  Files           139      142    +3     
  Lines          2494     2569   +75     
=========================================
+ Hits           2486     2561   +75     
  Misses            8        8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@J-Ben87 J-Ben87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit of documentation regarding where/how to configure the DSN part would be a plus, otherwise this sounds great to me.

@yann-eugone
Copy link
Contributor Author

@J-Ben87 WDYT ?
38c2541

@yann-eugone yann-eugone merged commit 00ea597 into 0.x May 2, 2024
@yann-eugone yann-eugone deleted the symfony-job-launcher-configuration branch January 29, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants