本文整理匯總了Golang中github.com/sclasen/swfsm/fsm.FSMContext類的典型用法代碼示例。如果您正苦於以下問題:Golang FSMContext類的具體用法?Golang FSMContext怎麽用?Golang FSMContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FSMContext類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: activity
func (w *WorkerFSM) activity(ctx *fsm.FSMContext, name string, input interface{}) *swf.Decision {
var serialized *string
if input != nil {
serialized = S(ctx.Serialize(input))
}
return &swf.Decision{
DecisionType: S(swf.DecisionTypeScheduleActivityTask),
ScheduleActivityTaskDecisionAttributes: &swf.ScheduleActivityTaskDecisionAttributes{
ActivityId: S(name),
ActivityType: &swf.ActivityType{Name: S(name), Version: S(name)},
Input: serialized,
HeartbeatTimeout: S("30"),
ScheduleToStartTimeout: S("NONE"),
ScheduleToCloseTimeout: S("NONE"),
StartToCloseTimeout: S("NONE"),
TaskList: &swf.TaskList{Name: S("aTaskListSharedBetweenTaskOneAndTwo")},
},
}
}
示例2: afterTwo
func (w *WorkerFSM) afterTwo(ctx *fsm.FSMContext, h *swf.HistoryEvent, data interface{}) {
result := new(Output2)
ctx.EventData(h, result)
data.(*Input1).Data = result.Data2
w.done <- struct{}{}
}
示例3: afterOne
func (w *WorkerFSM) afterOne(ctx *fsm.FSMContext, h *swf.HistoryEvent, data interface{}) {
result := new(Output1)
ctx.EventData(h, result)
data.(*Input1).Data = result.Data
}