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

Adds the ability to set the AssignWorker attribute not only directly on Workflow or Activity classes, but also on their parent classes. #74

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

butschster
Copy link
Member

This PR introduces a feature that automatically registers activities and workflows with a designated worker when they implement a specific interface. This functionality applies to both Activity and Workflow classes.

Here's an example in PHP to illustrate the concept:

use Spiral\TemporalBridge\Attribute\AssignWorker;
use Temporal\Activity\ActivityInterface;
use Temporal\Workflow\WorkflowInterface;

#[AssignWorker(name: 'some-worker')]
#[ActivityInterface]
interface SomeActivityInterface
{
    // Interface methods for activities
}

#[AssignWorker(name: 'some-worker')]
#[WorkflowInterface]
interface SomeWorkflowInterface
{
    // Interface methods for workflows
}

With this implementation, any activity or workflow that implements SomeActivityInterface or SomeWorkflowInterface, respectively, will be automatically registered with the some-worker.

This enhancement streamlines the process of linking workers to both activities and workflows, ensuring a more efficient and consistent setup with minimal manual configuration.

…on Workflow or Activity classes, but also on their parent classes.
@butschster butschster added the enhancement New feature or request label Dec 14, 2023
@butschster butschster requested a review from msmakouz December 14, 2023 12:53
@butschster butschster self-assigned this Dec 14, 2023
@butschster butschster merged commit ab48701 into 2.0 Dec 15, 2023
0 of 3 checks passed
@butschster butschster deleted the feature/assign-worker-inherit branch December 15, 2023 05:54
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.

2 participants