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

Add reference for communicator library #48

Merged
merged 2 commits into from
Jan 26, 2024
Merged

Conversation

chuck-dbos
Copy link
Contributor

No description provided.


Invoke the communicator from a `WorkflowContext`:
```typescript
const curDate = await wfCtx.invoke(CurrentTimeCommunicator).getCurrentDate();
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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...

@chuck-dbos chuck-dbos merged commit 5210c5a into main Jan 26, 2024
1 check passed
@chuck-dbos chuck-dbos deleted the chuck/ndfunctions branch January 26, 2024 16:22
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 this pull request may close these issues.

4 participants