Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Activity ¶
type Activity interface {
// Eval is called when an Activity is being evaluated. Returning true indicates
// that the task is done.
Eval(ctx Context) (done bool, err error)
// Metadata returns the metadata of the activity
Metadata() *Metadata
}
Activity is an interface for defining a custom Activity Execution
type AsyncActivity ¶
type AsyncActivity interface {
Activity
// PostEval is called when a activity that didn't complete during the Eval
// needs to be notified. Returning true indicates that the activity is done.
PostEval(context Context, userData interface{}) (done bool, evalError *Error)
}
AsyncActivity is an interface for defining a custom Task that supports asynchronous callback
type Context ¶
type Context interface {
// ActivityHost gets the "host" under with the activity is executing
ActivityHost() Host
//Name the name of the activity that is currently executing
Name() string
// GetSetting gets the value of the specified setting
GetSetting(setting string) (value interface{}, exists bool)
// GetInitValue gets the specified initialization value
GetInitValue(key string) (value interface{}, exists bool)
// GetInput gets the value of the specified input attribute
GetInput(name string) interface{}
// GetOutput gets the value of the specified output attribute
GetOutput(name string) interface{}
// SetOutput sets the value of the specified output attribute
SetOutput(name string, value interface{})
// Deprecated: Use ActivityHost().Name() instead.
TaskName() string
// Deprecated: Use ActivityHost() instead.
FlowDetails() FlowDetails
}
Context describes the execution context for an Activity. It provides access to attributes, task and Flow information.
type DynamicIO ¶
type DynamicIO interface {
// IOMetadata get the input/output metadata
IOMetadata(ctx Context) (*data.IOMetadata, error)
}
DynamicIO is an optional interface that can be implemented by an activity. If implemented, IOMetadata() will be invoked to determine the inputs/outputs of the activity instead of relying on the static information from the Activity's Metadata
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is an activity error
type FlowDetails
deprecated
type FlowDetails interface {
// ID returns the ID of the Flow Instance
ID() string
// FlowName returns the name of the Flow
Name() string
// ReplyHandler returns the reply handler for the flow Instance
ReplyHandler() ReplyHandler
}
Deprecated: Use ActivityHost() instead.
type Host ¶
type Host interface {
// ID returns the ID of the Activity Host
ID() string
// Name the name of the Activity Host
Name() string
// IOMetadata get the input/output metadata of the activity host
IOMetadata() *data.IOMetadata
// Reply is used to reply to the activity Host with the results of the execution
Reply(replyData map[string]*data.Attribute, err error)
// Return is used to indicate to the activity Host that it should complete and return the results of the execution
Return(returnData map[string]*data.Attribute, err error)
//todo rename, essentially the flow's attrs for now
WorkingData() data.Scope
// GetResolver gets the resolver associated with the activity host
GetResolver() data.Resolver
}
type Metadata ¶
type Metadata struct {
ID string
Version string
Settings map[string]*data.Attribute
Input map[string]*data.Attribute
Output map[string]*data.Attribute
ProducesResult bool
DynamicIO bool
}
Metadata is the metadata for the Activity
func NewMetadata ¶
NewMetadata creates the metadata object from its json representation
func (*Metadata) UnmarshalJSON ¶
UnmarshalJSON overrides the default UnmarshalJSON for TaskEnv
type ReplyHandler ¶
type ReplyHandler interface {
// Reply is used to reply with the results of the instance execution
Reply(code int, data interface{}, err error)
}
ReplyHandler is used to reply back to whoever started the flow instance