Skip to main content

16. Flow Service

Access via client.flow(). This queries the Flow — PlantPulse's visual automation screens — and their nodes (Flow Nodes). This is a new service added in V5.

Note: The V5 Flow service is read-only. Flow creation/editing/execution should be done via the UI or the Flow engine's dedicated API. For details on how the Flow engine works, refer to the Flow engine documentation.

16.1 Method Overview​

MethodReturn TypeHTTPEndpoint
get(flow_id)FlowResponseV5 or nullGET/api/v5/flow/{id}
list()List<FlowResponseV5> (includes statistics)GET/api/v5/flow
listNodes(flow_id)List<FlowNodeResponseV5>GET/api/v5/flow/{id}/node

16.2 FlowResponseV5 DTO​

FieldTypeDescription
flow_idStringFlow ID (PK)
flow_nameStringFlow name
descriptionStringDescription
enabledbooleanActive status
is_rootbooleanRoot Flow flag
debug_modebooleanDebug mode
insert_user / insert_dateStringRegistrar / registration time
update_user / update_dateStringModifier / modification time
node_countintNode count (statistics)
trigger_countintTrigger count (statistics)
error_countlongCumulative error count (statistics)

16.3 FlowNodeResponseV5 DTO​

FieldTypeDescription
flow_node_idStringNode ID (PK)
flow_idStringParent Flow
typeStringNode type (trigger, function, action, etc.)
nameStringNode name
configuration_jsonStringNode configuration JSON string
position_x / position_yintCanvas position
debug_modebooleanNode-level debug

16.4 Usage Examples​

Flow list (with statistics)​

import java.util.List;
import plantpulse.api.v5.dto.response.FlowResponseV5;

List<FlowResponseV5> flows = client.flow().list();
for (FlowResponseV5 f : flows) {
System.out.printf("[%s] %s — 노드 %d개, 트리거 %d개, 에러 %d건%n",
f.isEnabled() ? "ON" : "OFF",
f.getFlow_name(),
f.getNode_count(),
f.getTrigger_count(),
f.getError_count());
}

Example output:

[ON] 생산 카운트 집계 — 노드 8개, 트리거 1개, 에러 0건
[ON] 알람 알림 라우팅 — 노드 12개, 트리거 3개, 에러 2건
[OFF] (실험) ML 예측 — 노드 5개, 트리거 0개, 에러 0건

Single Flow query​

FlowResponseV5 flow = client.flow().get("flow_001");
if (flow != null && !flow.isEnabled()) {
System.err.println("Flow가 비활성 상태: " + flow.getFlow_name());
}

Node list of a Flow​

import plantpulse.api.v5.dto.response.FlowNodeResponseV5;

String flowId = "flow_001";
List<FlowNodeResponseV5> nodes = client.flow().listNodes(flowId);
for (FlowNodeResponseV5 n : nodes) {
System.out.printf(" [%s] %s (%s)%n",
n.getType(), n.getName(), n.getFlow_node_id());
}

Identifying Flows with errors​

import java.util.stream.Collectors;

List<FlowResponseV5> errored = client.flow().list().stream()
.filter(f -> f.getError_count() > 0)
.collect(Collectors.toList());

System.out.println("에러 발생 Flow: " + errored.size() + "개");
for (FlowResponseV5 f : errored) {
System.out.printf(" %s: %d건%n", f.getFlow_name(), f.getError_count());
}

16.5 Use Case Scenarios​

Scenario — Flow health dashboard​

while (running) {
List<FlowResponseV5> all = client.flow().list();

long total = all.size();
long enabled = all.stream().filter(FlowResponseV5::isEnabled).count();
long errored = all.stream().filter(f -> f.getError_count() > 0).count();
long triggers = all.stream().mapToInt(FlowResponseV5::getTrigger_count).sum();

updateUI(total, enabled, errored, triggers);
Thread.sleep(5_000);
}

Next Steps​

  • Flow engine guide — how Flow works (separate document)
  • Integration examples — Flow and API integration examples