Action Nodes
Action nodes thực thi hành động dựa trên message — lưu dữ liệu vào DB, tạo/xóa alarm, gửi lệnh RPC, gọi API ngoài, gửi thông báo.
Save Telemetry
Lưu msg payload vào time-series database:
Default TTL: 0 (infinite)
Scope: TENANT
Input message phải có format:
// Format 1 — không có timestamp (server gán)
{ "temperature": 25.5, "humidity": 60 }
// Format 2 — có timestamp
{ "ts": 1609459200000, "values": { "temperature": 25.5 } }Save Attributes
Lưu msg payload thành attributes:
Scope: SERVER_SCOPE / CLIENT_SCOPE / SHARED_SCOPE
| Scope | Ai ghi/đọc |
|---|---|
SERVER_SCOPE | Server ghi, server đọc |
CLIENT_SCOPE | Thiết bị ghi, server đọc |
SHARED_SCOPE | Server ghi, thiết bị đọc |
Create Alarm
Tạo alarm khi điều kiện xảy ra:
Alarm type: High Temperature
Alarm severity: CRITICAL
Propagate: ✓ (lan lên customer, tenant)
Propagate to: ASSET (nếu có quan hệ)
Script (details): {
"temperature": ${msg.temperature},
"threshold": ${metadata.threshold}
}
Lifecycle:
- Node tạo alarm nếu chưa có alarm cùng type + originator
- Nếu đã có alarm, update severity/details
- Output
CreatedhoặcUpdated
Clear Alarm
Xóa (clear) alarm khi điều kiện hết:
Alarm type: High Temperature
Script (details): {
"clearedAt": ${metadata.ts},
"note": "Temperature normalized"
}
Output Cleared hoặc False (không có alarm để clear).
REST API Call
Gọi HTTP endpoint ngoài:
URL: https://api.example.com/devices/${deviceId}/update
Method: POST
Headers:
Content-Type: application/json
Authorization: Bearer ${metadata.apiToken}
Timeout: 5000ms
Max parallel: 10
URL template — thay thế ${...} từ metadata.
Body — chính là msg payload (JSON).
Response thành công → metadata.statusCode, metadata.status, msg = response body.
Output: Success (kể cả 4xx/5xx), Failure (network error, timeout).
Send RPC Reply
Gửi response cho thiết bị khi nhận RPC request:
Request ID: ${metadata.requestId}
Response: ${msg}
Send RPC Request to Device
Gửi lệnh RPC đến thiết bị:
Method: reboot
Params: { "timeout": 60 }
Timeout: 30000ms
Thiết bị phải đang online và subscribe RPC topic.
Send Email
Gửi email qua SMTP:
From: ${metadata.from}
To: ${metadata.to}
Subject: ${metadata.subject}
Body: ${msg.body}
Cần cấu hình SMTP trong System Settings > Mail Server.
Send Notification
Gửi notification qua Notification Center:
Template: High Temperature Alert
Recipients: [Tenant Admin, Device Owner]
Notification sẽ xuất hiện trong Notification Center và có thể gửi qua email/SMS/Slack/Teams.
Assign to Customer
Gán originator entity vào một customer:
Customer name: ${metadata.customerName}
Unassign from Customer
Gỡ entity khỏi customer hiện tại.
Log
Ghi log để debug rule chain:
Log level: INFO
Script: return 'Device: ' + metadata.deviceName +
' | Temp: ' + msg.temperature;
Xem log tại Rule Engine > Debug hoặc Events của rule chain.
Message Count
Đếm số message theo key, lưu vào server attribute:
Telemetry prefix: msg_count_
Interval: 1 minute
Hữu ích để monitor throughput từng thiết bị.
Kafka Publish
Publish message lên Kafka topic:
Topic: iot-telemetry
Brokers: kafka:9092
Acks: 1
Key: ${metadata.deviceId}
MQTT Publish
Publish message tới MQTT broker ngoài:
Broker: mqtt://broker.example.com:1883
Topic: devices/${deviceId}/data
QoS: 1
Retained: false
RabbitMQ Publish
Exchange: iot-exchange
Queue: telemetry
Routing key: ${metadata.deviceType}
Ví dụ pipeline hoàn chỉnh
[Telemetry In]
↓
[Originator Attributes: threshold, customer_email]
↓
[Script Filter: temperature > threshold]
↓ True ↓ False
[Create Alarm: High Temp] [Clear Alarm: High Temp]
↓ ↓
[Send Notification] [Log: temperature OK]
↓
[REST API Call: alert system]