[
        {
            "step": 1,
            "name": "get_pending_retries",
            "action": "query",
            "description": "Get submissions ready for retry",
            "query": "SELECT q.*, s.* FROM taxcore_queue q JOIN taxcore_submissions s ON q.submission_id = s.submission_id WHERE q.status = 'queued' AND q.retry_count < q.max_retries AND q.next_retry_at <= NOW() ORDER BY q.priority DESC, q.next_retry_at ASC LIMIT 50",
            "output": "retry_items",
            "on_empty": "skip",
            "on_error": "fail"
        },
        {
            "step": 2,
            "name": "process_each_retry",
            "action": "foreach",
            "description": "Process each retry item",
            "items": "${retry_items}",
            "steps": [
                {
                    "step": "2a",
                    "name": "submit_to_taxcore",
                    "action": "http_post",
                    "description": "Re-submit to TaxCore service",
                    "url": "http://taxcore-service:3001/sale",
                    "headers": {
                        "Content-Type": "application/json"
                    },
                    "body": "${item.request_payload}",
                    "timeout": 30,
                    "on_success": "continue",
                    "on_error": "continue"
                },
                {
                    "step": "2b",
                    "name": "update_retry_count",
                    "action": "update",
                    "description": "Increment retry count",
                    "table": "taxcore_queue",
                    "where": {
                        "queue_id": "${item.queue_id}"
                    },
                    "data": {
                        "retry_count": "${item.retry_count + 1}",
                        "next_retry_at": "${now + (item.base_delay_minutes * 60 * Math.pow(item.backoff_multiplier, item.retry_count))}",
                        "updated_at": "${now}"
                    }
                },
                {
                    "step": "2c",
                    "name": "check_max_retries",
                    "action": "conditional",
                    "description": "Check if max retries exceeded",
                    "condition": "${item.retry_count + 1 >= item.max_retries}",
                    "on_true": {
                        "action": "trigger_event",
                        "event": "taxcore:retry:exceeded",
                        "data": "${item}"
                    }
                }
            ]
        },
        {
            "step": 3,
            "name": "log_completion",
            "action": "log",
            "description": "Log queue processing completion",
            "level": "info",
            "message": "Processed ${retry_items.length} TaxCore retry items"
        }
    ]