### Quickstart Examples Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/README.md Links to quickstart examples for various languages. ```bash Java: https://github.com/littlehorse-enterprises/lh-examples/tree/main/quickstart/java Go: https://github.com/littlehorse-enterprises/lh-examples/tree/main/quickstart/go Python: https://github.com/littlehorse-enterprises/lh-examples/tree/main/quickstart/python C#: https://github.com/littlehorse-enterprises/lh-examples/tree/main/quickstart/csharp ``` -------------------------------- ### Start a Task Worker Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/casting/README.md Starts the task worker for the casting example. ```bash cd ./examples/go/casting/worker go run . ``` -------------------------------- ### Start Workers Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/variables/README.md Command to start the workers for the example-variables project. ```bash ./gradlew example-variables:run ``` -------------------------------- ### Setup Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/js/structs/README.md Installs the necessary Node.js dependencies for the project. ```bash npm install ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/parallel-approval/README.md Registers WfSpec, TaskDefs, ExternalEventDefs, and starts the Task Worker. ```bash # Register the WfSpec/TaskDefs/ExternalEventDefs and # also start the Task Worker ./gradlew example-parallel-approval:run ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/type-adapter/README.md Commands to run the example worker and workflow. ```bash ./gradlew example-type-adapter:run ``` ```bash lhctl run example-type-adapter ``` -------------------------------- ### Run the UserTasksExample Java Application Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/user-tasks/README.md This command deploys the TaskDef, UserTaskDefs, WfSpec, and starts the LHTaskWorker for the User Tasks example. ```bash ./gradlew example-user-tasks:run ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/spawn-thread-foreach/README.md Command to run the Java example using Gradle. ```bash ./gradlew example-spawn-thread-foreach:run ``` -------------------------------- ### Start Workflow Run Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/dotnet/casting/README.md Starts a workflow run using the lhctl command-line tool. ```bash lhctl run casting-workflow ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/output-topic/README.md Command to run the output topic example using Gradle. ```bash ./gradlew example-output-topic:run ``` -------------------------------- ### Register and Start Workers Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/struct-builder/README.md Command to register StructDefs, TaskDefs, and WfSpec, and start task workers. ```bash ./gradlew example-struct-builder:run ``` -------------------------------- ### Install/Update Dependencies Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/casting/README.md Install or update project dependencies using Poetry. ```bash poetry install ``` -------------------------------- ### Start a workflow run with lhctl Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/arrays/README.md This command starts a workflow run using the lhctl command-line tool. No input variables are required for this example. ```bash # No input variables are required for this example lhctl run example-arrays ``` -------------------------------- ### Start workers and register metadata Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/inline-struct-placeholder/README.md This command starts the workers and registers the necessary metadata, including StructDefs, TaskDefs, and WfSpec, for the inline struct placeholder example. ```bash ./gradlew example-inline-struct-placeholder:run ``` -------------------------------- ### Run the .NET example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/dotnet/ArraysExample/README.md Commands to build and run the .NET example. ```bash cd examples/dotnet/ArraysExample dotnet build dotnet run ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/wait-for-one-of/README.md Command to execute the Java example using Gradle. ```bash ./gradlew example-wait-for-one-of:run ``` -------------------------------- ### Running the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/run-wf/README.md Command to execute the example in `RunWfExample.java`. ```bash ./gradlew example-run-wf:run ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/json/README.md Commands to execute the example using poetry and python. ```bash poetry shell python -m example_json ``` -------------------------------- ### Running the StructDef Example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/struct-def/README.md Command to run the StructDef example using Gradle. ```bash ./gradlew example-struct-def:run ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/retries/README.md Commands to run the example locally. ```bash poetry shell python -m retries ``` -------------------------------- ### Local development scripts setup Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/README.md Setup LittleHorse locally using local development scripts. ```bash ./local-dev/setup.sh ./local-dev/do-server.sh ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/wait-for-condition/README.md Command to run the Java example using Gradle. ```sh ./gradlew example-wait-for-condition:run ``` -------------------------------- ### Running the workflow with lhctl Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/error_handling/README.md Commands to start and inspect the workflow using lhctl. ```bash # Start the workflow lhctl run example-error-handling # Then inspect the wfRun: lhctl get wfRun ``` -------------------------------- ### Run the task worker Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/taskmetadata/README.md Deploys the task worker by running the specified Go program. This needs to be left running. ```bash go run ./examples/go/taskmetadata/worker ``` -------------------------------- ### Running the Example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/structdef/README.md Commands to run the StructDef example using poetry and Python. ```bash poetry shell python -m example_structdef ``` -------------------------------- ### Standalone container setup Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/README.md Quickest way to run LittleHorse locally using a standalone container. ```bash docker run --rm --pull=always --name littlehorse -d \ -p 9092:9092 -p 2023:2023 -p 8080:8080 \ ghcr.io/littlehorse-enterprises/littlehorse/lh-standalone:latest ``` -------------------------------- ### Run the example with Gradle Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/expressions/README.md This command executes the Expression example using Gradle. ```sh ./gradlew example-expressions:run ``` -------------------------------- ### Running the example with Python Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/basic/README.md Commands to execute the basic example using Python. ```bash poetry shell python -m example_basic ``` -------------------------------- ### Register the WfSpec Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/taskmetadata/README.md Registers the Workflow Specification (WfSpec) by running the deploy script. ```bash go run ./examples/go/taskmetadata/deploy ``` -------------------------------- ### Running Go examples Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/README.md Commands to run the basic Go example, demonstrating separate worker and deploy programs. ```bash # Terminal 1 (keep running) go run ./examples/go/basic/worker # Terminal 2 go run ./examples/go/basic/deploy lhctl run basic-workflow name Obi-Wan ``` -------------------------------- ### Run a WfRun Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/taskmetadata/README.md Initiates a Workflow Run (WfRun) with specific input data using the lhctl command-line tool. ```bash lhctl run task-metadata-workflow input '{"foo": 1, "art":{"id":1,"title": "bugia", "content": "lol"}}' ``` -------------------------------- ### Run the task worker Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/structdef/README.md Starts the task worker which registers TaskDefs and StructDefs. ```bash go run ./examples/go/structdef/worker ``` -------------------------------- ### Running the Gradle Example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/child-thread/README.md Command to run the child thread example using Gradle. ```bash ./gradlew example-child-thread:run ``` -------------------------------- ### Running Java examples Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/README.md Gradle command to run a specific Java example from the repository root. Replace {name} with the desired example name. ```bash ./gradlew example-{name}:run ``` -------------------------------- ### Running the example with Poetry shell Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/child_threads/README.md Commands to set up and run the Python example using poetry shell. ```bash poetry shell python -m example_child_thread ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/interrupt-handler/README.md Command to run the interrupt handler example using Gradle. ```bash ./gradlew example-interrupt-handler:run ``` -------------------------------- ### Running the Python Example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/mutation/README.md Commands to set up the environment and run the Python example. ```bash poetry shell python -m example_mutation ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/external-event/README.md Command to run the external event example using Gradle. ```bash ./gradlew example-external-event:run ``` -------------------------------- ### Running the example with poetry and python Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/error_handling/README.md Commands to execute the Python example locally. ```bash poetry shell python -m example_error_handling ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/external_event/README.md Commands to run the Python example and interact with the workflow using lhctl. ```bash poetry shell python -m example_external_event ``` ```bash # Start the workflow lhctl run example-external-event # Take the resulting workflow ID, and do: lhctl get wfRun # Note that it is 'RUNNING'. Next, post an external event using the following: lhctl postEvent name-event STR Obi-Wan # Then inspect the wfRun: # Note it is 'COMPLETED' lhctl get wfRun # Then inspect the output of the ExternalEvent and how it completed the nodeRun: lhctl get nodeRun 0 1 lhctl get taskRun ``` -------------------------------- ### Run the Python Example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/casting/README.md Execute the Python casting example script. ```bash poetry shell python -m example_casting ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/checkpoint_tasks/README.md Commands to run the checkpointed task example using poetry and python. ```bash poetry shell python -m example_checkpoint_tasks ``` -------------------------------- ### Start the Task Worker Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/conditionals/ifelse/README.md Command to start the task worker for the if/else conditional example. ```bash go run ./examples/go/conditionals/ifelse/worker ``` -------------------------------- ### Build and Run the Example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/dotnet/CheckpointTasksExample/README.md Commands to build and run the CheckpointTasksExample project. ```bash dotnet build dotnet run ``` -------------------------------- ### Start the Task Worker Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/childthread/README.md Command to start the task worker for the child thread example. ```bash go run ./examples/go/childthread/worker ``` -------------------------------- ### Running Basic Example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/dotnet/README.md Builds and runs the BasicExample workflow. ```bash cd examples/dotnet/BasicExample dotnet build dotnet run ``` -------------------------------- ### Install dependencies and start development server Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/dashboard/README.md Commands to install project dependencies and start the development server with watch mode. ```shell npm install npm run dev ``` -------------------------------- ### Run Worker Context Example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/worker-context/README.md Commands to run the worker context example using Gradle and lhctl. ```bash ./gradlew example-worker-context:run ``` ```bash lhctl run example-worker-context request-time $(date +%s%3N) ``` -------------------------------- ### Helpful commands Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/type-adapter/README.md Commands to inspect workflow runs, node runs, and task runs. ```bash lhctl get wfRun ``` ```bash lhctl list nodeRun ``` ```bash lhctl get taskRun ``` -------------------------------- ### Running the example with Poetry and Python Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/conditionals_while/README.md Commands to activate the poetry shell and run the Python example script. ```bash poetry shell python -m example_conditionals_while ``` -------------------------------- ### Running the Example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/casting/README.md Executes the example-casting Gradle task. ```bash ./gradlew example-casting:run ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/python/interruption/README.md Commands to execute the Python example and interact with the workflow using lhctl. ```bash poetry shell python -m example_interruption ``` ```bash # Run a new workflow lhctl run example-interrupt-handler # Take the resulting workflow ID, and do: lhctl get wfRun # Note that it is 'RUNNING'. Next, post an external event using the following: lhctl postEvent interruption-event NULL # Then inspect the wfRun: # Note that the threadRuns number 1 is 'ERROR' with type 'INTERRUPT' lhctl get wfRun # Then you can inspect the output of the ExternalEvent: lhctl get nodeRun 1 1 lhctl get taskRun ``` -------------------------------- ### Start the Task Worker Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/conditionals/while/README.md Command to start the task worker for the while conditional example. ```bash go run ./examples/go/conditionals/while/worker ``` -------------------------------- ### Run BasicExample with lhctl Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/dotnet/BasicExample/README.md Command to execute the 'greet' task in the BasicExample workflow using lhctl. ```bash lhctl run example-basic input-name foo ``` -------------------------------- ### Run the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/exception-handler/README.md Command to execute the Java example using Gradle. ```bash ./gradlew example-exception-handler:run ``` -------------------------------- ### get() Method Example - Struct Field Access Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/proposals/011-type-safe-structpaths.md Example of using the new WfRunVariable#get() method to access a field ('name') on a Struct variable ('customer'). ```Java WfRunVariable customer = wf.declareStruct("input-customer", Customer.class); wf.execute("greet", customer.get("name")); ``` -------------------------------- ### Run the example Java app Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/arrays/README.md This command executes the example Java application. ```bash ./gradlew example-arrays:run ``` -------------------------------- ### Start the Task Worker Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/interrupt/README.md Starts the task worker which includes two Task Functions. ```bash go run ./examples/go/interrupt/worker ``` -------------------------------- ### Run a WfRun Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/bytes/README.md Initiates a WfRun using the lhctl command. ```bash lhctl run bytes-workflow ``` -------------------------------- ### get() Method Example - Array Item Access Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/proposals/011-type-safe-structpaths.md Example of using the new WfRunVariable#get() method to access the first customer in an Array of Customers and then their 'name' field. ```Java WfRunVariable customers = wf.declareStruct("input-customers", Customer[].class); wf.execute("greet", customer.get(0).get("name")); ``` -------------------------------- ### Start the task workers Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/run-child-workflow/README.md Starts the task workers for the child workflow example. ```go go run ./examples/go/run-child-workflow/worker ``` -------------------------------- ### Get External Event Definition Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/correlated-event/README.md Command to get the external event definition for 'document-signed'. ```bash lhctl get externalEventDef document-signed ``` -------------------------------- ### Running Examples Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/AGENTS.md Command to run examples in the project. ```bash ./gradlew example-foo:run ``` -------------------------------- ### Deploy the example Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/wait-for-condition/README.md This command deploys the wait for condition example. ```sh go run ./examples/go/wait-for-condition/deploy ``` -------------------------------- ### Start the Task Worker Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/externalevent/README.md Starts the task worker by running the main Go program for the worker. ```bash go run ./examples/go/externalevent/worker ``` -------------------------------- ### Start the Workflow with lhctl Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/dotnet/UserTasksExample/README.md Command to start the 'it-request' workflow using lhctl, setting the initial user-id to 'anakin'. ```bash lhctl run it-request user-id anakin ``` -------------------------------- ### Start the Task Worker Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/exceptionhandler/README.md This command starts the Task Worker, which includes two threads for the two Task Functions defined. ```bash go run ./examples/go/exceptionhandler/worker ``` -------------------------------- ### Run Dashboard Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/local-dev/README.md Installs npm dependencies and starts the dashboard development server. ```bash cd dashboard npm install npm run dev ``` -------------------------------- ### Running the workflow with lhctl Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/basic/README.md Examples of using lhctl to run the 'greet' task with different input configurations. ```bash # The "input-name" variable here is treated as null lhctl run example-basic # Here, we specify that the "input-name" variable = "Obi-Wan" lhctl run example-basic input-name Obi-Wan # This call fails since there is no defined "foo" variable lhctl run example-basic foo bar ``` -------------------------------- ### Get workflow run status Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/parallel-approval/README.md Verifies the number of pending approvals. ```bash lhctl get wfRun 0 5 ``` -------------------------------- ### Run Examples Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/sdk-dotnet/README.md Commands to run various example applications using the SDK. ```bash dotnet run --project ./Examples/BasicExample dotnet run --project ./Examples/ExceptionsHandlerExample dotnet run --project ./Examples/MaskedFieldsExample dotnet run --project ./Examples/WorkerContextExample ``` -------------------------------- ### Get NodeRun ID Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/conditionals/ifelse/README.md Command to retrieve the NodeRun ID for a specific workflow run. ```bash lhctl get nodeRun 0 2 ``` -------------------------------- ### Get all-approved variable Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/parallel-approval/README.md Retrieves the value of the 'all-approved' variable to confirm all approvals have been gathered. ```bash lhctl get variable 0 all-approved ``` -------------------------------- ### Verify WfSpec registration Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/taskmetadata/README.md Verifies the registration of the WfSpec using the lhctl command-line tool. ```bash lhctl get wfSpec task-metadata-workflow ``` -------------------------------- ### Run the task worker Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/go/bytes/README.md Deploys the task worker by running the specified Go command. This process should be left running. ```bash go run ./examples/go/bytes/worker ``` -------------------------------- ### Register a TaskDef and WfSpec - JavaScript (Worker) Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/README.md Install dependencies and start the worker in JavaScript. ```bash cd examples/js/simple-worker npm install npm start ``` -------------------------------- ### Get node run status Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/parallel-approval/README.md Inspects the status of node runs to see which approval failed. ```bash lhctl get nodeRun 0 5 ``` -------------------------------- ### Get Task Run Details Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/js/simple-worker/README.md Retrieves details for a specific task run within a workflow. ```bash lhctl get taskRun ``` -------------------------------- ### Register a TaskDef and WfSpec - C# Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/README.md Start an example in C# to register a TaskDef, Task Worker, and WfSpec. ```bash cd examples/dotnet/BasicExample dotnet run ``` -------------------------------- ### Register a TaskDef and WfSpec - Python Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/README.md Start an example in Python to register a TaskDef, Task Worker, and WfSpec. ```bash cd examples/python/basic poetry shell python -m example_basic ``` -------------------------------- ### Run the example with Gradle Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/conditionals-while/README.md Command to execute the example using Gradle. ```bash ./gradlew example-conditionals-while:run ``` -------------------------------- ### Register a TaskDef and WfSpec - Java Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/README.md Start an example in Java to register a TaskDef, Task Worker, and WfSpec. ```bash ./gradlew example-basic:run ``` -------------------------------- ### Run the app Source: https://github.com/littlehorse-enterprises/littlehorse/blob/master/examples/java/timestamp/README.md Command to run the timestamp example locally. ```bash ./gradlew :example-timestamp:run ```