{"id":18403729,"url":"https://github.com/russellluo/orchestrator","last_synced_at":"2025-05-15T08:31:45.302Z","repository":{"id":57626061,"uuid":"400978934","full_name":"RussellLuo/orchestrator","owner":"RussellLuo","description":"A Go library for service orchestration.","archived":false,"fork":false,"pushed_at":"2024-06-11T06:05:35.000Z","size":156,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T07:36:49.918Z","etag":null,"topics":["api-gateway","golang","service-orchestration"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/RussellLuo/orchestrator","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RussellLuo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-29T07:28:18.000Z","updated_at":"2025-03-28T15:22:07.000Z","dependencies_parsed_at":"2024-01-09T03:10:31.719Z","dependency_job_id":"945e7bdb-ba4c-4694-a38e-26e7288481b5","html_url":"https://github.com/RussellLuo/orchestrator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RussellLuo%2Forchestrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RussellLuo%2Forchestrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RussellLuo%2Forchestrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RussellLuo%2Forchestrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RussellLuo","download_url":"https://codeload.github.com/RussellLuo/orchestrator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254304638,"owners_count":22048444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-gateway","golang","service-orchestration"],"created_at":"2024-11-06T02:48:01.982Z","updated_at":"2025-05-15T08:31:45.276Z","avatar_url":"https://github.com/RussellLuo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Orchestrator\n\nA Go library for service orchestration, inspired by [Conductor][1].\n\n\n## Core Concepts\n\n### Task\n\nTasks are the fundamental building blocks of Orchestrator. They are similar to primitive types or statements in a programming language.\n\nTypically, a [task](task.schema.json) accepts an input and returns an output. Each parameter in the input can be a literal value or an [expression](#expression).\n\nBuilt-in tasks:\n\n- [Decision](https://pkg.go.dev/github.com/RussellLuo/orchestrator/builtin#Decision)\n- [Terminate](https://pkg.go.dev/github.com/RussellLuo/orchestrator/builtin#Terminate)\n- [Loop](https://pkg.go.dev/github.com/RussellLuo/orchestrator/builtin#Loop)\n- [Iterate](https://pkg.go.dev/github.com/RussellLuo/orchestrator/builtin#Iterate)\n- [HTTP](https://pkg.go.dev/github.com/RussellLuo/orchestrator/builtin#HTTP)\n- [Serial](https://pkg.go.dev/github.com/RussellLuo/orchestrator/builtin#Serial)\n- [Parallel](https://pkg.go.dev/github.com/RussellLuo/orchestrator/builtin#Parallel)\n- [Call](https://pkg.go.dev/github.com/RussellLuo/orchestrator/builtin#Call)\n- [Code](https://pkg.go.dev/github.com/RussellLuo/orchestrator/builtin#Code)\n- [Wait](https://pkg.go.dev/github.com/RussellLuo/orchestrator/builtin#Wait)\n\n\n### Flow\n\nA flow is used to define a piece of logic, which usually consists of one or more tasks. Flows are similar to functions or routines in a programming language.\n\nIn Orchestrator, a flow is essentially a composite task (i.e. a `Serial` task). Therefore, just like a task, a flow accepts an input and returns an output. Furthermore, a flow can be embedded into another flow by leveraging a `Call` task, thus serving as a sub-flow.\n\n### Expression\n\nExpressions are used to extract values out of the flow input and other tasks in the flow.\n\nFor example, a flow is supplied with an input by the client/caller when a new execution is triggered. The flow input is available via an expression of the form `${input.\u003cvar\u003e}` (see [dialects](#dialects)). Likewise, the output of a previously executed task can also be extracted using an expression (e.g. `${\u003ctask\u003e.\u003coutput_var\u003e}`) for use in the input of a subsequent task.\n\n\n#### Dialects\n\nCurrently supported expression dialects:\n\n- [Starlark][3]\n\n    In addition to Starlark's built-in functions, there are some more pre-declared functions:\n    - `getenv(key)`: Retrieve the value of the environment variable named by the key.\n    - `isiterator(v)`: Whether the given value v is an Orchestrator Iterator.\n    - `jsonencode(v)`: Encode the given value v to a JSON string ([go.starlark.net/lib/json](https://pkg.go.dev/go.starlark.net/lib/json)).\n    - `jsondecode(v)`: Decode the given JSON string to a value ([go.starlark.net/lib/json](https://pkg.go.dev/go.starlark.net/lib/json)).\n\n    Examples:\n\n    ```\n    ${input.value}  // Value from the input.\n    ${tool.status == 200}  // Whether the status code (from an HTTP task `tool`) is 200\n    ${len(tool.body.entities)}  // Length of the response entities (from an HTTP task `tool`)\n    ${[s*2 for s in input.scores]}  // List comprehension\n    ${{k: v.upper() for k, v in input.properties.items()}}  // Dictionary comprehension\n    ```\n\n- [Expr][4]\n\n    \u003cdetails\u003e\n      \u003csummary\u003e (- expand -) \u003c/summary\u003e\n\n    Examples:\n\n    ```\n    #{input.value}  // Value from the input.\n    #{tool.status == 200}  // Whether the status code (from an HTTP task `tool`) is 200\n    #{len(tool.body.entities)}  // Length of the response entities (from an HTTP task `tool`)\n    //#{[s*2 for s in input.scores]}  // UNSUPPORTED\n    //#{{k: v.upper() for k, v in input.properties.items()}}  // UNSUPPORTED\n    ```\n\n    \u003c/details\u003e\n\n- JSONPath ([spec][5] and [implementation][6])\n\n    \u003cdetails\u003e\n      \u003csummary\u003e (- expand -) \u003c/summary\u003e\n\n    Examples:\n\n    ```\n    @{input.value}  // Value from the input.\n    //@{tool.status == 200}  // UNSUPPORTED\n    //@{len(tool.body.entities)}  // UNSUPPORTED\n    //@{[s*2 for s in input.scores]}  // UNSUPPORTED\n    //@{{k: v.upper() for k, v in input.properties.items()}}  // UNSUPPORTED\n    ```\n\n    \u003c/details\u003e\n\n\n## Flow Builders\n\nOrchestrator provides three ways to build a flow.\n\n\n### Go\n\n```go\nflow := builtin.NewSerial(\"get_todo_user\").Timeout(3*time.Second).Tasks(\n\tbuiltin.NewHTTP(\"get_todo\").Timeout(2*time.Second).Get(\n\t\t\"https://jsonplaceholder.typicode.com/todos/${input.todoId}\",\n\t),\n\tbuiltin.NewHTTP(\"get_user\").Timeout(2*time.Second).Get(\n\t\t\"https://jsonplaceholder.typicode.com/users/${get_todo.body.userId}\",\n\t),\n).Build()\n```\n\nSee [Example](https://pkg.go.dev/github.com/RussellLuo/orchestrator#example-package) for the complete example.\n\n\n### YAML\n\n```yaml\nname: get_todo_user\ntype: serial\ntimeout: 3s\ninput:\n  tasks:\n  - name: get_todo\n    type: http\n    timeout: 2s\n    input:\n      method: GET\n      uri: https://jsonplaceholder.typicode.com/todos/${input.todoId}\n  - name: get_user\n    type: http\n    timeout: 2s\n    input:\n      method: GET\n      uri: https://jsonplaceholder.typicode.com/users/${get_todo.body.userId}\n```\n\nSee [Example (Yaml)](https://pkg.go.dev/github.com/RussellLuo/orchestrator#example-package-Yaml) for the complete example.\n\n\n### JSON\n\n```json\n{\n  \"name\": \"get_todo_user\",\n  \"type\": \"serial\",\n  \"timeout\": \"3s\",\n  \"input\": {\n    \"tasks\": [\n      {\n        \"name\": \"get_todo\",\n        \"type\": \"http\",\n        \"timeout\": \"2s\",\n        \"input\": {\n          \"method\": \"GET\",\n          \"uri\": \"https://jsonplaceholder.typicode.com/todos/${input.todoId}\"\n        }\n      },\n      {\n        \"name\": \"get_user\",\n        \"type\": \"http\",\n        \"timeout\": \"2s\",\n        \"input\": {\n          \"method\": \"GET\",\n          \"uri\": \"https://jsonplaceholder.typicode.com/users/${get_todo.body.userId}\"\n        }\n      }\n    ]\n  }\n}\n```\n\nSee [Example (Json)](https://pkg.go.dev/github.com/RussellLuo/orchestrator#example-package-Json) for the complete example.\n\n\n## Documentation\n\nCheckout the [Godoc][2].\n\n\n## License\n\n[MIT](LICENSE)\n\n\n[1]: https://github.com/Netflix/conductor\n[2]: https://pkg.go.dev/github.com/RussellLuo/orchestrator\n[3]: https://github.com/google/starlark-go/blob/master/doc/spec.md#expressions\n[4]: https://expr.medv.io/\n[5]: https://goessner.net/articles/JsonPath/\n[6]: https://github.com/PaesslerAG/jsonpath\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussellluo%2Forchestrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frussellluo%2Forchestrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussellluo%2Forchestrator/lists"}