Build a Temporal workflow using the Temporal Go SDK that performs transactional updates to three external APIs (e.g., crudcrud.com). The workflow should:
- Ensure all three API calls complete successfully within a configurable time limit
- Trigger compensating actions (rollbacks) if any step fails or the time limit is exceeded
- Be triggered via a REST API
- Be fully reproducible using Docker Compose
- Include test cases for all success/failure scenarios
- The Temporal workflow should:
- Call three independent external services (e.g., three different endpoints of crudcrud.com)
- Abort and roll back any completed steps if:
- An API call fails
- The workflow exceeds a configurable timeout
- Use the Saga pattern to coordinate compensating actions
- Configuration should be provided via environment variables or config files:
TRANSACTION_TIMEOUT_SECONDS: Time bound for the entire workflow- API endpoint URLs or keys
- (Optional) Enable/disable mock mode for testing
- Expose a REST endpoint (framework of your choice) to:
- Accept a JSON payload describing the operation
- Trigger the Temporal workflow with the provided parameters
- Return a workflow ID or execution result
- Provide a
docker-compose.yamlthat starts:- Temporal server
- Go worker service running the workflow
- REST API service
- (Optional) mock API server if needed
- Provide tests for:
- Successful execution across all services
- Failures at different steps (e.g., second or third API fails)
- Workflow timeout scenario
- Retry or rollback edge cases
Use any .NET-compatible test framework (e.g., xUnit, NUnit).
- Source Code: Go solution with Temporal workflow, API layer, and configuration
- Docker Compose: Reproducible setup for Temporal, API, and worker services
- Tests: Automated test cases covering all critical scenarios
- README:
- Setup instructions
- Example request payloads
- Environment variable/config details
- Notes on extensibility and customization