English | 简体中文
Minimal usage example for client/workflow using http protocol
Refer to dtm installation and running
go run main.go
The order of execution can be seen in the log of workflow-http as follows.
- TransOut
- TransIn
The entire workflow transaction was executed successfully
A complete example includes following steps:
app.POST(qsBusiAPI+"/workflowResume", func(ctx *gin.Context) {
log.Printf("workflowResume")
data, err := ioutil.ReadAll(ctx.Request.Body)
logger.FatalIfError(err)
workflow.ExecuteByQS(ctx.Request.URL.Query(), data)
})
workflow.InitHTTP(dtmServer, qsBusi+"/workflowResume")
wfName := "workflow-http"
err := workflow.Register(wfName, func(wf *workflow.Workflow, data []byte) error {
// ...
_, err = wf.NewBranch().NewRequest().SetBody(req).Post(qsBusi + "/TransOut")
// http request using wf.NewRequest() will be automaticly be intercepted and recorded
}
err = workflow.Execute(wfName, shortuuid.New(), data)