-
Notifications
You must be signed in to change notification settings - Fork 0
add Entitty utility #2
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
base: main
Are you sure you want to change the base?
Conversation
| await client.Signal(entity.Signal, { increment: 1 }) | ||
| console.log(await client.Query(entity.Query)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we want to be fancy we can even collapse this to entity.signal() and entity.query() by absorbing the client calls into Entity, but not sure if there would be significant impact on workflow bundle size.
| this.workflow = this.workflow.bind(this); | ||
| } | ||
|
|
||
| async workflow(input: Input, isContinued = false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How's the worker going to know the name of this workflow?
You need to export a workflow function per entity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the biggest question. perhaps i can attach a name on that workflow
| interface Input { /* define your workflow input type here */ } | ||
| interface Update { /* define your workflow update type here */ } | ||
| const entity = new Entity<Input, Update>({ | ||
| activity: 'MyActivityName' | ||
| activityOptions: { | ||
| startToCloseTimeout: '1 minute', | ||
| } | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a workflow code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually.. if i dont make it workflow code, then i dont have to register it separately. it could be very interesting.
|
Some other general comments. This type of workflow is good for when you want to ensure only a single update is applied concurrently. Lastly, you could really use some tests for this code. |
i am planning to switch to
not sure how to achieve that, i thought we have to drain before continuing? |
there are some type considerations i havent figured out yet but this is the kind of developer experience i am looking for.