Hey all,
I am seeking some help on how to go about versioning a workflow that is running. I have read the docs and they mostly point to information about wrapping activities in the getVersion flow. But my question is more about an actual change in the workflow.
ie we have a workflow that creates a record in a database, then it sits in a loop waiting on signals and performs status changes to the record and if a specific status happens we end the workflow and its completed.
We was currently only checking one status but some changes happened and we need to change this to two status’. But as we already have these workflow’s running we want to check the status and end the workflow that is already being executed, so changing the flow of the workflow.
My question is based on this very lose and rough example when a replay happens, would the proxy loop run through with any previous requests?
func (w *WorkflowParams) Workflow(ctx workflow.Context, args *WorkflowInput) (string, error) {
logger := workflow.GetLogger(ctx)
var item model.Item
workflow.ExecuteActivity(ctx, createRecord, args).Get(ctx, &item)
workflow.ExecuteActivity(ctx, addData, item).Get(ctx, &item)
for {
callingWorkflowId, statusRequest := proxy.ReceiveRequest(ctx)
workflow.ExecuteActivity(ctx, updateStatus, item, statusRequest).Get(ctx, &item)
if item.Status == "completed" {
break
}
}
return item
}
If we added the extra check for the status change, would this run the existing workflows and end them?
func (w *WorkflowParams) Workflow(ctx workflow.Context, args *WorkflowInput) (string, error) {
logger := workflow.GetLogger(ctx)
var item model.Item
workflow.ExecuteActivity(ctx, createRecord, args).Get(ctx, &item)
workflow.ExecuteActivity(ctx, addData, item).Get(ctx, &item)
for {
callingWorkflowId, statusRequest := proxy.ReceiveRequest(ctx)
workflow.ExecuteActivity(ctx, updateStatus, item, statusRequest).Get(ctx, &item)
if item.Status == "completed" || item.Status == "failed" {
break
}
}
return item
}
If we added an “if block” above the for loop to check the status, we would only get the status at that current point in time, correct?
How could we get fork the flow moving forwards having previously running and new workflows use this new check to end?