-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from neighborhoods/KOJO-143-state-transition-l…
…ogger-process-framework KOJO-143 | Job State Changelog Processor process framework
- Loading branch information
Showing
19 changed files
with
247 additions
and
28 deletions.
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
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,31 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neighborhoods\Kojo\Process; | ||
|
||
use Neighborhoods\Kojo\Semaphore; | ||
|
||
class JobStateChangelogProcessor extends Forked implements JobStateChangelogProcessorInterface | ||
{ | ||
use Semaphore\Resource\Factory\AwareTrait; | ||
|
||
public const TYPE_CODE = 'job_state_changelog_processor'; | ||
|
||
protected function _run(): Forked | ||
{ | ||
$this->_getLogger()->debug('JobStateChangelogProcessor has been instantiated'); | ||
|
||
if ($this->_getSemaphoreResource('job_state_changelog_processor')->testAndSetLock()) { | ||
$this->_getLogger()->debug('JobStateChangelogProcessor has acquired mutex'); | ||
|
||
// TODO: replace with business logic | ||
while (true) { | ||
sleep(1); | ||
} | ||
} else { | ||
$this->_getLogger()->debug('JobStateChangelogProcessor failed to acquire mutex'); | ||
} | ||
|
||
return $this; | ||
} | ||
} |
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,16 @@ | ||
services: | ||
neighborhoods.kojo.process.job_state_changelog_processor: | ||
class: Neighborhoods\Kojo\Process\JobStateChangelogProcessor | ||
public: true | ||
shared: false | ||
parent: process_abstract | ||
calls: | ||
- [setTypeCode, ['job_state_changelog_processor']] | ||
- [setProcessStrategy, ['@process.strategy.process_control']] | ||
- [setTerminationSignalNumber, ['@=constant("SIGTERM")']] | ||
- [setUuidMaximumInteger, [9999999999]] | ||
- [setProcessPoolFactory, ['@process.pool.factory-job_state_changelog_processor']] | ||
- [setTitlePrefix, ['%process.title.prefix%']] | ||
- [addSemaphoreResourceFactory, ['@semaphore.resource.factory-job_state_changelog_processor']] | ||
process.job_state_changelog_processor: | ||
alias: neighborhoods.kojo.process.job_state_changelog_processor |
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,10 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neighborhoods\Kojo\Process; | ||
|
||
use Neighborhoods\Kojo\ProcessInterface; | ||
|
||
interface JobStateChangelogProcessorInterface extends ProcessInterface | ||
{ | ||
} |
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
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
Oops, something went wrong.