I have a newbie question regarding signals using the Java SDK. I was HelloSignal example and was trying out the following:
- From Process A, start the workflow execution. Workflow completes the first Activity and waits for the signal.
Code:
WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();
WorkflowClient client = WorkflowClient.newInstance(service);
WorkflowOptions options = WorkflowOptions.newBuilder()
.setTaskQueue(Util.TASK_QUEUE)
.setWorkflowExecutionTimeout(Duration.ofDays(1L))
.setWorkflowId("welcome-email")
.build();`
ExpeditionWorkflow workflow = client.newWorkflowStub(ExpeditionWorkflow.class, options);
WorkflowClient.start(workflow::execute);
System.out.println("Successfully started");`
- From Process B, send a signal to the workflow execution started by process B:
WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();
WorkflowClient client = WorkflowClient.newInstance(service);
WorkflowOptions options = WorkflowOptions.newBuilder()
.setTaskQueue(Util.TASK_QUEUE)
.setWorkflowExecutionTimeout(Duration.ofDays(1L))
.setWorkflowId("welcome-email")
.build();
DescribeWorkflowExecutionRequest e;
ExpeditionWorkflow workflow = client.newWorkflowStub(ExpeditionWorkflow.class, options);
String[] signal = {"WelcomeEmailPlacement", "Open"};
workflow.placementReceived(signal);`
However, it looks like the workflow execution isn’t being set in process B and I’m getting the error Null workflowId. Was workflow started?
coming in from WorkflowStubImpl
. What am I missing here?