I have a method that is used to trigger a workflow by creating a BatchRequest.
public static void triggerIngestTask(WorkflowClient workflowClient, IngestTask task) {
// Set workflowId to userId
WorkflowOptions options = WorkflowOptions.newBuilder()
.setTaskQueue(IngestConstants.Queues.INGEST)
.setWorkflowId(task.getTaskId())
.setWorkflowTaskTimeout(null)
.build();
// Use workflow interface stub to initialise/signal workflow instance
SerializedIngestWorkflow workflow = workflowClient.newWorkflowStub(SerializedIngestWorkflow.class, options);
BatchRequest request = workflowClient.newSignalWithStartRequest();
request.add(workflow::execute);
request.add(workflow::addTask, task);
workflowClient.signalWithStart(request);
}
I would also like to setup a separate workflow that is scheduled as a cron job that would trigger the workflow above. Is there a way to trigger the workflow from within a workflow using a similar approach to a BatchRequest?