Complete Go implementation for progressive Temporal training exercises.
- Go 1.21+
- Temporal CLI
macOS (Homebrew):
brew install temporalLinux:
curl -sSf https://temporal.download/cli.sh | shWindows:
scoop install temporal-cliOr download directly: Visit https://github.com/temporalio/cli/releases and download the appropriate binary for your platform.
- Start Temporal dev server with AccountId search attribute:
temporal server start-dev --search-attribute AccountId=Text- Install dependencies:
go mod downloadExercise 1: Hello Temporal (30 min)
- Basic Workflow and Activity setup
- Worker registration and execution
Exercise 2: Money Transfer Basics (45 min)
- Multiple activities (withdraw, deposit, refund)
- Signal-based approval mechanism
- workflow.Await() for conditional waiting
- Basic error handling and compensation
Exercise 3: Query Handlers (35 min)
- Query methods for workflow state inspection
- Status tracking throughout execution
- External workflow monitoring
- Signal vs Query differences
Exercise 4: Visibility & Monitoring (30 min)
- Custom Search Attributes (AccountId)
- Upsert Search Attributes from workflows
- Workflow filtering and discovery
- Activity summaries for better observability
- Enhanced monitoring in Temporal Web UI
Exercise 6: Testing Strategy (45 min)
- Unit tests with testsuite
- Time skipping for fast tests
- Activity mocking with testify/mock
- Search attribute registration in tests
Exercise 7: Manual Activity Retry (40 min)
- Manual retry pattern using signals
- Invalid data handling scenarios
- Disabling automatic retries
- Interactive retry commands
# Start worker
go run solution1/worker/main.go
# Run workflow (in another terminal)
go run solution1/starter/main.go# Start worker
go run solution2/worker/main.go
# Run workflow (in another terminal)
go run solution2/starter/main.go# Start worker
go run solution3/worker/main.go
# Run workflow (in another terminal)
go run solution3/starter/main.go# Start worker
go run solution4/worker/main.go
# Run workflow (in another terminal)
go run solution4/starter/main.go# Start worker
go run solution5/worker/main.go
# Run workflow (in another terminal)
go run solution5/starter/main.go# Run tests
go test ./solution6 -v# Start worker
go run solution7/worker/main.go
# Run workflow (in another terminal)
go run solution7/starter/main.go
# Or send retry signal manually
temporal workflow signal \
--workflow-id money-transfer-workflow \
--name retry \
--input '{"Key":"fromAccount","Value":"account-123"}'- Go Structs: Modern data structures
- Activity Retry: Configurable retry policies
- Signal/Query: Workflow interaction patterns
- Search Attributes: Custom filtering
- Activity Summaries: Enhanced observability
- Compensation: Saga pattern for rollbacks
- Testing: Time-skipping unit tests with testify
- Error Handling: Distinguishes activity vs workflow failures
- Manual Retry: Signal-based retry for failed activities
.
├── solution1/ # Hello Temporal
├── solution2/ # Money Transfer Basics
├── solution3/ # Query Handlers
├── solution4/ # Visibility & Monitoring
├── solution5/ # Activity Summaries
├── solution6/ # Testing Strategy
├── solution7/ # Manual Activity Retry
└── go.mod
Each solution contains:
workflow.go- Workflow implementationactivities.go- Activity implementationsmodels.go- Data structuresworker/main.go- Worker startupstarter/main.go- Workflow starterworkflow_test.go- Unit tests (solution6)