Skip to main content

16. Flow Service

Accessed via client.flow(). Retrieves PlantPulse visual workflows (Flow) and the nodes within them (Flow Node). This is a service newly added in V5.

Note: The V5 Flow service is read-only. Creating, modifying, and executing Flows is done through the UI or the Flow engine's dedicated API. For details on how the Flow engine works, see the Flow engine documentation.

16.1 Method List

MethodReturn TypeHTTPEndpoint
get(flow_id)FlowResponseV5 or nullGET/api/v5/flow/{id}
list()List<FlowResponseV5> (with 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
enabledbooleanWhether enabled
is_rootbooleanWhether it is a root Flow
debug_modebooleanDebug mode
insert_user / insert_dateStringCreator / timestamp
update_user / update_dateStringModifier / timestamp
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_modebooleanPer-node 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건

Retrieving a Single Flow

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 Usage 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 — examples of integrating Flow with the API