本文整理汇总了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
}