Skip to content

Add a new sample to start and interact with signal workflow directly via cadence client #78

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

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

chopincode
Copy link
Contributor

This example demonstrates how to start a signal workflow first, save workflowID aside and reuse it to send signals in the future.

To use this example, you must keep the worker running in background. Run the first binary SignalWorkflowStarter, which will start a new signal workflow and save the workflow ID into a local file. Run the second binary SignalSender to retrieve the saved workflow ID and send signals to it. It can also cancel the workflow by calling the cancel method of the signal interface.

// create a new stub using the retrieved workflowID
WorkflowClient workflowClient = CadenceUtil.getWorkflowClient();
// To send a signal, only workflowID is needed.
SignalWorkflow signalWorkflow =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add some logs "signallng workflow %s"

Comment on lines +62 to +63
writer.write(workflowID);
writer.close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's check the errors in case there's permission issues etc. to create/read/write/delete file

@@ -0,0 +1,88 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there going to be a corresponding README to show how to run this scenario?

@ibarrajo ibarrajo added the enhancement New feature or request label Mar 7, 2024
@ibarrajo ibarrajo merged commit 50c6793 into master Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants