Been looking into Temporal for fast few days, looking for some advice
There’s HTTP request which request workflow start.
var workflowId = "my-workflow-prefix-%s".formatted("some-unique-identifier");
var workflowOptions = WorkflowOptions.newBuilder()
.setWorkflowId(workflowId)
.setTaskQueue("my-task-queue")
.build();
var workflow = workflowClient.newWorkflowStub(MyWorkflow.class, workflowOptions);
var execution = WorkflowClient.start(workflow::processWorkflow, convert(jobSummary));
return new HttpSuccessResponse( "requested to start workflow workflowID=%s runID=%s".format(execution.getWorkflowId(), execution.getRunId()))
Here is my workflow implementation
class MyWorkflowImpl implements MyWorkflow {
... different activity definitions ...
OutputActivity outActivity = Workflow.newActivityStub(OutputActivity.class, MY_ACTIVITY_OPTIONS);
public WorkflowOutput processWorkflow(WorkflowInput input){
..... <workflow executions>.....
WorkflowOutput output = new WorkflowOutput(...);
outActivity.sendResponse(output);
}
}
When all workflow activity completes, using outActivity to notify. Workflow options have setCompletionCallbacks
method. Is there any way I can add my own callback object which provides me WorkflowOutput
instance.
Currently (actually proposed) the way we design whole workflow is - We have 3 Activities running on 3 different services across network. Backend Service which started workflow, only need to know once workflow completes & receive WorkflowOutput
object. This object is composite object consiting all other activities output.