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

HOB: withSubscription #14

Merged
merged 4 commits into from
Nov 21, 2021
Merged

HOB: withSubscription #14

merged 4 commits into from
Nov 21, 2021

Conversation

christoph-fricke
Copy link
Owner

Makes it less verbose to subscribe an actor that is spawned from a behavior to a publisher.
The subscription is handled automatically by the life-cycle of the behavior.

Instead of manually subscribing and unsubscribing the spawned actor, its behavior can simply be wrapped in withSubscription.

const behavior: Behavior/* ... */;
const publisher: ActorRef/* ... */;

const wrapped = withSubscription(behavior, publisher, ["publish-matches"]);
const actor = spawnBehavior(wrapped);

Makes it less verbose to subscribe an actor that is spawned from a behavior to a publisher.
The subscription is handled automatically by the lifecycle of the behavior.
@christoph-fricke christoph-fricke added the enhancement New feature or request label Nov 19, 2021
@christoph-fricke christoph-fricke merged commit 81fd916 into main Nov 21, 2021
@christoph-fricke christoph-fricke deleted the cfr/with-subscription branch November 21, 2021 12:22
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.

1 participant