-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add reference for communicator library #48
Conversation
|
||
Invoke the communicator from a `WorkflowContext`: | ||
```typescript | ||
const curDate = await wfCtx.invoke(CurrentTimeCommunicator).getCurrentDate(); |
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.
Don't we have to attach CurrentTimeCommunicator
to the static class? I am familiar with this type of usage await ctxt.invoke(PlaidPayments).paymentWebhook(webhook, session_id, notification, client_ref);
where paymentWebhook
is a communicator defined in PlaidPayments
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.
Could you please explain the suggestion a bit more.
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.
Sorry, it is just my misunderstanding: I didn't realize we could call invoke
on a class (here CurrentTimeCommunicator
) different than the workflow's. Or at least, I assume this the case here, i.e., the line above is called from a Workflow belonging to a static class different than CurrentTimeCommunicator
.
Is that correct?
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.
So the context provides invoke... which will use the class type (CurrentTimeCommunicator is a class with static methods) to in turn produce another type that provides functions to call. It can do this with any class.
Yes, you'd be using some other workflow method, probably originating from a decorated class static method, but it could be through a call chain also...
No description provided.