Skip to content
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

Adding an ability to register activities and workflows in specific workers #21

Merged
merged 1 commit into from
Jul 13, 2022

Conversation

msmakouz
Copy link
Member

Q A
Bugfix?
Breaks BC?
New feature? ✔️
  • Added an ability to register activities and workflows in specific workers.
    Need to add Spiral\TemporalBridge\Attribute\AssignWorker with a worker name.
use Spiral\TemporalBridge\Attribute\AssignWorker;

#[AssignWorker(name: 'worker1')]
class SomeActivity
{
}
  • Added defaultWorker parameter in config. In this parameter, can specify the name of the default worker.
  • Added workers parameter in config. In this parameter, can set worker options.
// file app/config/temporal.php

use Temporal\Worker\WorkerOptions;

return [
    'workers' => [
        'worker1' => WorkerOptions::new()
    ]
]
  • Added method addWorkerOptions to the Spiral\TemporalBridge\Bootloader\TemporalBridgeBootloader. This method allows to register workers with the necessary options.
<?php

declare(strict_types=1);

namespace App\Bootloader;

use Spiral\Boot\Bootloader\Bootloader;
use Spiral\TemporalBridge\Bootloader\TemporalBridgeBootloader;
use Temporal\Worker\WorkerOptions;

final class AppBootloader extends Bootloader
{
    public function init(TemporalBridgeBootloader $temporalBridgeBootloader): void 
    {
        $temporalBridgeBootloader->addWorkerOptions('first', WorkerOptions::new());
        $temporalBridgeBootloader->addWorkerOptions('second', WorkerOptions::new());
    }
}

@butschster butschster self-assigned this Jul 13, 2022
@butschster butschster added the enhancement New feature or request label Jul 13, 2022
@butschster butschster merged commit 8be3759 into spiral:2.0 Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants