Documentation ¶
Index ¶
- Constants
- Variables
- func RecoverExecutions(ctx context.Context, key string, startIndex, batchSize int) error
- func RecoverWorkflow(ctx workflow.Context, params Params) error
- func TripWorkflow(ctx workflow.Context, state UserState) error
- type ClientKey
- type ListOpenExecutionsResult
- type Params
- type RestartParams
- type SignalParams
- type TripEvent
- type UserState
Constants ¶
const ( // TripSignalName is the signal name for trip completion event TripSignalName = "trip_event" // QueryName is the query type name QueryName = "counter" )
Variables ¶
var ( // ErrClientNotFound when client is not found on context ErrClientNotFound = errors.New("failed to retrieve client from context") // ErrExecutionCacheNotFound when executions cache is not found on context ErrExecutionCacheNotFound = errors.New("failed to retrieve cache from context") )
var HostID = "recovery_" + uuid.New()
HostID - Use a new uuid just for demo so we can run 2 host specific activity workers on same machine. In real world case, you would use a hostname or ip address as HostID.
Functions ¶
func RecoverExecutions ¶
func RecoverWorkflow ¶
RecoverWorkflow is the workflow implementation to recover TripWorkflow executions
func TripWorkflow ¶
TripWorkflow to keep track of total trip count for a user It waits on a TripEvent signal and increments a counter on each signal received by this workflow Trip count is managed as workflow state and passed to new run after 10 signals received by each execution
Types ¶
type ListOpenExecutionsResult ¶
ListOpenExecutionsResult is the result returned from listOpenExecutions activity
func ListOpenExecutions ¶
func ListOpenExecutions(ctx context.Context, workflowType string) (*ListOpenExecutionsResult, error)
type RestartParams ¶
type RestartParams struct { Options client.StartWorkflowOptions State UserState }
RestartParams are parameters extracted from StartWorkflowExecution history event
type SignalParams ¶
SignalParams are the parameters extracted from SignalWorkflowExecution history event