Example #1
0
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")},
		},
	}
}
Example #2
0
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{}{}
}
Example #3
0
func (w *WorkerFSM) afterOne(ctx *fsm.FSMContext, h *swf.HistoryEvent, data interface{}) {
	result := new(Output1)
	ctx.EventData(h, result)
	data.(*Input1).Data = result.Data
}