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

Remove onEvent and add subscription noun instead #277

Closed
sam-goodwin opened this issue Feb 10, 2023 · 0 comments · Fixed by #284
Closed

Remove onEvent and add subscription noun instead #277

sam-goodwin opened this issue Feb 10, 2023 · 0 comments · Fixed by #284

Comments

@sam-goodwin
Copy link
Owner

We've decided to apply the following convention across all Eventual primitives.

noun(fqn, props, handler)

For example:

activity("activityName", { timeout: duration(1, "minute") }, async () => {
  await database.get()
});

As a part of #264, we've also landed on the following name:

commands // all of the named commands/apis 
subscriptions // all of the named subscriptions
events // of the named event schemas
activities // all of the named activities
workflows // named workflows
// etc.

This issue tracks the change to remove onEvent and instead add the subscription entity:

export const onUser = subscription("onUser", {
  events: [OnUserEvent]
}, async (event) => {
  //
});

Benefits:

  1. it is consistent and aligns with all other eventual primitives
  2. it reads better - userEvent.onEvent("onUserEvent" is flawed because it reads like the name is the message being subscribed to.
  3. properties can be used for declarative configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant