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

Canvas Item Decorator For Asynchronous Workflow Item #338

Closed
Michaelpalacce opened this issue Jul 16, 2024 · 1 comment
Closed

Canvas Item Decorator For Asynchronous Workflow Item #338

Michaelpalacce opened this issue Jul 16, 2024 · 1 comment
Assignees
Labels
area/vrotsc Relates to `vrotsc` module effort/high kind/feature New Feature to the project lang/typescript Related to typescript code priority/medium triage/needed Needs to be discussed by project maintainers version/minor Introduces a non-breaking feature or change

Comments

@Michaelpalacce
Copy link
Collaborator

Michaelpalacce commented Jul 16, 2024

Description

We want to support the possibility to define an "Asynchronous Element" with a decorator

The Async Element can be used to execute a "Workflow" asynchronously, giving you back a workflow execution token that can be used to wait for the workflow to complete and consequently extract state/outputs from it.

Example

This is how the workflow-item looks like when we are dealing with an "Asynchronous Element":

  <workflow-item name="item3" out-name="item0" type="task" launched-workflow-id="9e4503db-cbaa-435a-9fad-144409c08df0">
    <display-name><![CDATA[Other Workflow]]></display-name>
    <script encoded="false"><![CDATA[//Auto generated script, cannot be modified !
var workflowToLaunch = Server.getWorkflowWithId("9e4503db-cbaa-435a-9fad-144409c08df0");
if (workflowToLaunch == null) {
	throw "Workflow not found";
}

var workflowParameters = new Properties();
workflowParameters.put("first",first);
workflowParameters.put("second",second);
wfToken = workflowToLaunch.execute(workflowParameters);
]]></script>
    <in-binding>
      <bind name="first" type="number" export-name="first"/>
      <bind name="second" type="number" export-name="second"/>
    </in-binding>
    <out-binding>
      <bind name="wfToken" type="WorkflowToken" export-name="wfToken"/>
    </out-binding>
    <description><![CDATA[Start an asynchronous workflow.]]></description>
    <position y="60.0" x="300.0"/>
  </workflow-item>

Notes

  • The auto generated code is actually needed, but we can do it in a different manner as long as it actually starts a workflow with the given parameters.
    • This will require a separate SourceFilePrinter to handle this case.
    • You can use the ts.factory to generate the code block.
  • launched-workflow-id needs to be set as well, so the item looks correct in the canvas
@Michaelpalacce Michaelpalacce added lang/typescript Related to typescript code area/vrotsc Relates to `vrotsc` module version/minor Introduces a non-breaking feature or change kind/feature New Feature to the project priority/medium effort/high triage/needed Needs to be discussed by project maintainers labels Jul 16, 2024
@Michaelpalacce Michaelpalacce self-assigned this Jul 19, 2024
@akantchev
Copy link
Contributor

akantchev commented Jul 23, 2024

PR with implementation: #354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vrotsc Relates to `vrotsc` module effort/high kind/feature New Feature to the project lang/typescript Related to typescript code priority/medium triage/needed Needs to be discussed by project maintainers version/minor Introduces a non-breaking feature or change
Projects
None yet
Development

No branches or pull requests

2 participants