Hi all recently
we use selector to determine which flow to executed
now we have flow like this
we know how to make the process inside the sub process
but for the sub process part any idea what should we use from temporal feature
for !signalReceive && ctx.Err() == nil {
selector := workflow.NewSelector(ctx)
threeHourTimer := workflow.NewTimer(ctx, threeHour)
selector.AddFuture(threeHourTimer, func(f workflow.Future) {
err1 := f.Get(ctx, nil)
if err1 == nil {
logger.Debug("Success")
} else if ctx.Err() != nil {
logger.Error("Error occurred.", "error", ctx.Err())
}
})
selector.AddReceive(workflow.GetSignalChannel(ctx, SignalAction),
func(c workflow.ReceiveChannel, more bool) {
c.Receive(ctx, &request)
},
)
selector.Select(ctx)
}
how do we make the sub process ?
- future action for timer 2 days, and only executed if inside sub process aren’t done within 2 days