Execute a Circuit
Catalyst Circuits allow you to define, organize, and orchestrate a sequence of tasks to be carried out automatically. You can enable concurrent or sequential executions of Catalyst functions in a circuit, and additionally include conditions, data, and paths in it and automate the workflow.
The sample code below illustrates executing a circuit by referring to its unique Circuit ID and passing key-value pairs as the input JSON to the circuit. It also illustrates obtaining the circuit’s execution details by referring to its unique Execution ID saved in the execution history of the circuit.
The circuit reference used below is defined in the component instance page.
copy//Executes the circuit by referring to its Circuit ID and passes the input JSON circuit.execute('195000000041001', 'sampleName', { name: 'Aaron Jones'}).then((result) => { console.log(result); }).catch((err) => console.log(err.toString())); //Written to Catalyst logs //Returns the circuit's execution details by referring to the Circuit ID and Execution ID circuit.status('195000000041001', '195000000043002').then((result) => { console.log(result); }).catch((err) => console.log(err.toString())); //Written to Catalyst Logs //Aborts the circuit execution by referring to the Circuit ID and Execution ID circuit.abort('195000000041001', '195000000043002').then((result) => { console.log(result); }).catch((err) => console.log(err.toString())); //Written to Catalyst Logs
A sample response that you will receive is shown below. The response is the same for both versions of Node.js.
Node.js
copy{ id: "b3e2f61e-4795-428e-8365-3609bf2b5606", name: "Name", start_time: "Aug 18, 2021 07:35 PM", status: "running", status_code: 1, execution_meta: {}, circuit_details: { name: "NewCircuit", ref_name: "newcircuit", description: "", instance_id: "70454fc5-3bf6-45af-81ca-2742cc049698" }, input: { name: "Aaron Jones" } }
Last Updated 2024-01-04 12:37:42 +0530 +0530
Yes
No
Send your feedback to us