Skip to content

Latest commit

 

History

History
69 lines (50 loc) · 2.25 KB

File metadata and controls

69 lines (50 loc) · 2.25 KB

Task: Temporal Saga Workflow with External APIs in Go

Objective

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

Requirements

1. Workflow Logic

  • 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

2. Configurability

  • 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

3. REST Interface

  • 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

4. Dockerized Setup

  • Provide a docker-compose.yaml that starts:
    • Temporal server
    • Go worker service running the workflow
    • REST API service
    • (Optional) mock API server if needed

5. Testing

  • 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).


Deliverables

  • 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