Skip to main content

What does the Federal Criminal Search Workflow Definition look like?

workflows/federal_criminal_search.go

func FederalCriminalSearch(ctx workflow.Context, input *FederalCriminalSearchWorkflowInput) (*FederalCriminalSearchWorkflowResult, error) {
var result activities.FederalCriminalSearchResult

name := input.FullName
var address string
if len(input.KnownAddresses) > 0 {
address = input.KnownAddresses[0]
}
var crimes []string

activityInput := activities.FederalCriminalSearchInput{
FullName: name,
Address: address,
}
var activityResult activities.FederalCriminalSearchResult

ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: time.Minute,
})

federalcheck := workflow.ExecuteActivity(ctx, a.FederalCriminalSearch, activityInput)

err := federalcheck.Get(ctx, &activityResult)
if err == nil {
crimes = append(crimes, activityResult.Crimes...)
}
result.Crimes = crimes

r := FederalCriminalSearchWorkflowResult(result)
return &r, nil
}

Swim lane diagram of the Federal Criminal Search Child Workflow Execution