Workflow Serverside activity development guide
Hi All,
I am trying to develop vertigis studio workflow server side custom activity by following this guide. “https://developers.vertigisstudio.com/docs/workflow/tutorial-server-calculate-logarithm-activity/” The workflow version is 5.40.1 . I replace all <uuid> text with one uuid. “bc976e57-f211-4f1b-852b-c7e2537177c5” . And I follow this to register at workflow designer by using same uuid.
https://developers.vertigisstudio.com/docs/workflow/sdk-net-register-activities/
However after the deployment is done, it is not working and I am getting the error in the server side log as the following. May I know where could it be wrong? Can I get help. I have to use .net 8 to compile it as well. with .net 6 , I cannot compile at all.
"$type": "JobTraceLog",
"start": "2024-09-16T06:53:02.5510329Z",
"end": "2024-09-16T06:53:02.8510746Z",
"traces": [
"Error: 0: Unexpected Error: VertiGIS.Workflow.Runtime.Execution.Exceptions.ActivityAggregateException: [WF: Multiple errors] Multiple errors occurred while running activity: uuid:bc976e57-f211-4f1b-852b-c7e2537177c5::CalculateLogActivity.",
" ([WF: Activity binding error] Failed to bind activity 29 to action uuid:bc976e57-f211-4f1b-852b-c7e2537177c5::CalculateLogActivity: [WF: Activity not found error] Cannot find activity with action 'uuid:bc976e57-f211-4f1b-852b-c7e2537177c5::CalculateLogActivity'.)",
" ---> VertiGIS.Workflow.Runtime.Execution.Exceptions.ActivityBindingException: [WF: Activity binding error] Failed to bind activity 29 to action uuid:bc976e57-f211-4f1b-852b-c7e2537177c5::CalculateLogActivity: [WF: Activity not found error] Cannot find activity with action 'uuid:bc976e57-f211-4f1b-852b-c7e2537177c5::CalculateLogActivity'.",
" ---> VertiGIS.Workflow.Runtime.Execution.ActivityLoader.ActivityNotFoundException: [WF: Activity not found error] Cannot find activity with action 'uuid:bc976e57-f211-4f1b-852b-c7e2537177c5::CalculateLogActivity'",
" at VertiGIS.Workflow.Runtime.Execution.Engine.CreateHandler(String action, CancellationToken cancellation, ProgramInspector inspector)",
" at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ResolveActivityHandler(String action)",
" --- End of inner exception stack trace ---",
" at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ResolveActivityHandler(String action)",
" at VertiGIS.Workflow.Runtime.Execution.ActivityContext.WhenAllFinished(Task[] tasks)",
" --- End of inner exception stack trace ---",
" at VertiGIS.Workflow.Runtime.Execution.ActivityContext.WhenAllFinished(Task[] tasks)",
" at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteStart()",
" at VertiGIS.Workflow.Runtime.Execution.AmbientState.ExecuteCurrentContext()",
" at VertiGIS.Workflow.Runtime.Execution.AmbientState.Execute()",
" at VertiGIS.Workflow.Runtime.Execution.Engine.Run(Program program, RunOptions options)",
" at VertiGIS.Workflow.Hosts.Server.Host.RunWorkflow(String workflowJson, IDictionary`2 inputs, IDictionary`2 trivia, String accessToken, String portalUrl, CancellationToken cancellationToken)",
" at VertiGIS.Workflow.Server.Foundation.WorkflowRunner.ProcessAsync(Object content)"
]
},
-
Official comment
Than Aung I can confirm there is an error in the instructions in the guide.
The Action needs to be declared like this:
public static string Action { get; } = "uuid:<uuid>::CalculateLog";
It is correct in the first code snippet, but two subsequent ones declare it as a variable. It must be declared as a property (as shown above) to be properly detected as a valid Workflow Activity.
I will ensure the guide is updated.
-
The Developer Center has been updated. All examples of custom .activities for Workflow Server have been corrected.
1 -
Thanks Ken Lyon,
It worked after converting to property from variable.
One more comment for the server side sample, if user enter the integer value in either base or value , you will get wrong result. Somehow the object type passing to server side activity is integer type and it will not cast the value in this way of casting. (Refer to the below code block)
Moreover, Can you help update this as well https://developers.vertigisstudio.com/docs/workflow/sdk-server-overview/#debugging-server-workflow-activities
I can't find
GeocortexWorkflowServer.exe
at all.I found VertiGIS.Workflow.Server.exe from “C:\Program Files\VertiGIS\VertiGIS Studio Workflow\Web\service” and “C:\Program Files\VertiGIS\VertiGIS Studio Workflow\Deployment\service” and “C:\Program Files\VertiGIS\VertiGIS Studio Workflow\.working\Deployment\service”
However I can't find the process with this exe running in the process for me to attach from Visual studio debugger.
public Task<IDictionary<string, object>> Execute(IDictionary<string, object> inputs, IActivityContext context) { double? logBase = null; if (inputs.ContainsKey("base") && inputs["base"] != null) { logBase = Convert.ToDouble(inputs["base"]); } double value = 0.0; if(inputs.ContainsKey("value") && inputs["value"]!=null) { value = Convert.ToDouble(inputs["value"]); } double logResult; if (logBase != null && logBase.HasValue) { logResult = Math.Log(value, logBase.Value); } else { logResult = Math.Log(value); } return Task.FromResult((IDictionary<string, object>)new Dictionary<string, object>() { ["result"] = logResult }); }
1 -
Hey Ken Lyon,
I found that I need to attach w3wp.exe for my case.
Best Regards,
Than
1 -
Than Aung I've made some updates to that website, including improving the type handling in the Calculate Logarithm example, and the instructions for how to attach to the Workflow Server process.
Thanks for pointing these out!
1 -
Thanks Ken Lyon for the prompt response as well.
0
Please sign in to leave a comment.
Comments
6 comments