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.

Note: Circuits is currently not available to Catalyst users accessing from the EU, AU, IN, or CA data centers.

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.

ZCCircuitDetails is used to refer to the circuit, and ZCCircuitExecutionDetails returns the circuit execution details.

Ensure the following packages are imported:

    
copy
import org.json.simple.JSONObject; import com.zc.component.circuits.ZCCircuit; import com.zc.component.circuits.ZCCircuitDetails; import com.zc.component.circuits.ZCCircuitExecutionDetails; import com.zc.component.circuits.ZCCircuitExecutionStatus;
    
copy
//Executes the circuit by referring to its Circuit ID and passes the input JSON ZCCircuitDetails userBackupCircuit = ZCCircuit.getInstance().getCircuitInstance(1239000000L); JSONObject execInputJson = new JSONObject(); execInputJson.put("key", "value"); ZCCircuitExecutionDetails circuitExecution = userBackupCircuit.execute("Case 1",execInputJson); String executionId = circuitExecution.getExecutionId(); //Returns the Execution ID //Returns the circuit's execution details by referring to the Execution ID of the circuit. //You can write your own success logic here. ZCCircuitDetails userBackupCircuit = ZCCircuit.getInstance().getCircuitInstance(1239000000L); ZCCircuitExecutionDetails circuitExecution = userBackupCircuit.getExecutionDetails(executionId); if(circuitExecution.getStatus().equals(ZCCircuitExecutionStatus.SUCCESS)) { //Success logic } //Aborts the circuit execution by referring to the Execution ID of the circuit ZCCircuitDetails userBackupCircuit = ZCCircuit.getInstance().getCircuitInstance(1239000000L); userBackupCircuit.abortExecution(executionId);

Last Updated 2024-01-04 12:37:42 +0530 +0530

ON THIS PAGE