-
Notifications
You must be signed in to change notification settings - Fork 36
workflow
gojuukaze edited this page Aug 27, 2022
·
1 revision
ser := ytask.Server.NewServer(...)
client:= ser.GetClient()
tId, _ := client.Workflow().
Send("group1", "add", 123, 44).
Send("group1", "add").
Done()
tId, _ = client.Workflow().
SetTaskCtl(client.RunAfter, 2*time.Second).
Send("group1", "add", 123, 44).
SetTaskCtl(client.ExpireTime, time.Now()).
Send("group1", "add").
Done()
You can use GetResult()
to get the return value of the last task.
You can also use GetResult2()
to get the running progress of the workflow.
result, err := client.GetResult2(id, time.Second*2, time.Millisecond*300)
// workflow has not started
if yerrors.IsEqual(err, yerrors.ErrTypeTimeOut) {
// ...
}
// status: waiting , running , success , failure , expired , abort
for name, status:= range result.Workflow{
fmt.Println(name, status)
}