On this page
ZeroMQ collection client
Receives messages through a ZeroMQ SUB, PULL, or ROUTER socket and maps collection variables by topic and JSON path. Select a socket type that pairs with the sender.
Compatible devices and models
| Device series / model examples | Connection requirements |
|---|---|
| Devices and systems using ZeroMQ PUB, PUSH or ROUTER/DEALER | Match the peer to SUB/PULL/ROUTER mode and configure endpoints, topic filters, multipart boundaries and payload mapping. |
Configure the sender and multipart message
Pair PUB with SUB, PUSH with PULL, and DEALER with ROUTER. Only one side binds a TCP endpoint. With the default gateway Connect role, the sender can bind tcp://*:15555 and the gateway connects to tcp://192.168.1.80:15555; * is not a remote host.
Send one multipart message containing two UTF-8 frames: Topic device/data, then JSON {"Temperature":25.6,"Status":"Running"}. Do not concatenate them into one frame.
For a sender with Python ZeroMQ available:
import json
import time
import zmq
# PUB绑定监听端,等待订阅传播后定期发送主题及JSON两帧。
context = zmq.Context()
publisher = context.socket(zmq.PUB)
publisher.bind("tcp://*:15555")
time.sleep(1)
while True:
publisher.send_multipart([b"device/data", json.dumps({"Temperature": 25.6}).encode("utf-8")])
time.sleep(1)- Add the plugin under No channel, enter the sender endpoint, select Sub and disable Bind mode. Leave freshness time at
60000milliseconds for the one-second publisher. - Add read-only
Temperature, typeDouble, array length1. Select topicdevice/dataand JSONPath$.Temperature, with no condition:SubscribeTopic=device/data;Path=$.Temperature;. - Compare
25.6and the collection time after the next publication. PUB/SUB does not automatically replay messages published before subscription. - Topic
device/is a byte-prefix filter, not an MQTT+/#filter. Saved variable topics establish the active subscriptions; a device-level prefix does not create a variable mapping.
For PULL, an independent PUSH sends the same Topic/Payload frames. Multiple PULL consumers share messages rather than each receiving every message. A DEALER paired with ROUTER sends an empty delimiter, Topic and Payload; the routing identity is not JSON content. The debug send button does not create a separate PUB/PUSH peer.
See the official ZeroMQ guide for multipart and socket pairing.
Open the plugin
Enter “Development Configuration → Collection Configuration”, create a device and select “ZeroMQ collection client” in “Device Plugin”.
Supported channels and data types
| Channel type | Pre-configuration check |
|---|---|
| Plugin built-in connection | Connection parameters are configured in the device dynamic properties and do not use public TCP, UDP or serial channel parameters. |
Available data types: All variable data types are supported. Choose according to the extracted JSON value; select Object for a complete object or array.
Plugin properties
ZeroMQ Collection Client connects or binds its endpoint directly and does not use ordinary TCP, UDP, or serial channel fields. JSON fields do not use PLC register byte order or word offsets.
Connection configuration
| Setting | Description |
|---|---|
| Connection address | Default tcp://127.0.0.1:5555. Use the endpoint paired with the sender, not the TGateway Web address. |
| Socket type | Default Sub. Choose Sub, Pull, or Router to match the sender as described below. |
| Binding mode | Disabled by default: this side connects. Enable it to bind, with the peer taking the matching role. |
Socket type options are Sub (subscribe to a publisher), Pull (receive from a Push peer), and Router (pair with Dealer and reply by identity). The default is Sub. When Binding mode is enabled this side binds; otherwise it connects. Only one side may bind the same endpoint.
Message configuration
| Setting | Description |
|---|---|
| Subscription topic prefix | Empty by default. Saved variable topics establish the active Sub subscriptions; this field does not replace a variable topic. |
Saving variables maintains the active subscriptions from their configured topic prefixes; removing all variables clears the subscriptions. Pull and Router ignore this field.
Capacity limit
| Setting | Description |
|---|---|
| High water mark | Default 1000. Sets the collection socket receive-buffer high-water mark, not the number of saved history records. |
The high-water mark limits the socket receive buffer, not durable storage. Reaching it may block or drop messages depending on the paired socket types. It does not replace history storage or offline replay.
Log diagnostics
| Setting | Description |
|---|---|
| Detailed log | Disabled by default. When enabled and the device log level permits Trace, receive logs include Topic and Payload. When disabled, they include only Topic and remain subject to the log threshold. |
Caching and reliability
| Setting | Description |
|---|---|
| Check clearing time | Default 60000 ms. A read-only variable is marked offline after this period without a successful update. This is not a reconnect or retry interval. |
Messages for other topics, missing fields, and messages rejected by a condition do not advance that variable’s collection time. Keep the sender interval below this timeout, with allowance for network and processing delays.
Address rules
Use read-only variables and named PropertyName=Value address fields. JSONPath and condition parameter rules are shared with MQTT collection. For Topic device/data, use this JSON as the payload frame:
{
"Temperature": 25.6,
"Humidity": 60.5,
"Status": "Running"
}| Address field | Description |
|---|---|
| SubscribeTopic | Required. Matches the actual topic by a case-sensitive prefix. device/ matches device/data; MQTT + and # wildcard rules do not apply. |
| Path | Required. Supports root $, property paths, array indices, wildcards, filters, and candidate paths separated by ||. Reads the first existing result. Exact property names take precedence; case-insensitive matching requires a unique candidate. |
| Condition | Optional. Select a data transformation condition script. It receives the complete JSON body and must return true to update the variable. False results and execution errors reject the update. |
| ConditionParameters | Optional. A JSON object of input parameter texts, such as {"Minimum":"20"}. Select the script and edit its inputs in the address editor; each variable stores its own parameters. |
SubscribeTopic=device/data;Path=$.Temperatureextracts numeric25.6.SubscribeTopic=device/data;Path=$.missing||$.Statusextracts"Running".SubscribeTopic=device/data;Path=$.Status;Condition=TemperatureFilter;ConditionParameters={"Minimum":"20"}requires an existing condition script with a numericMinimuminput.- Filter arrays with a path such as
Path=$.items[?(@.code == 'A')].value; usePath=$for the complete payload. - Scripts can declare string inputs named
TopicorZeroMqTopicto read the actual message topic. Explicit parameters take precedence over automatic topic values. - URI-escape semicolons, percent signs, and whitespace inside field values. The address editor handles this automatically. Field names are case-insensitive; duplicate or unknown fields, invalid paths, and invalid parameters are rejected.
- Messages use two frames: Topic followed by a UTF-8 JSON Payload.
Routermessages also contain identity and empty delimiter frames; the plugin sends an empty reply automatically.
Special methods
| Method | Purpose | Parameters |
|---|---|---|
| SendDebugMessage | Send ZeroMQ debug message | topic=message topic, payload=message text |
Device debug
Enter “Development Configuration → Collection Configuration”, select the current device then open “Protocol Debug” at the top of the workspace.
Dedicated debugging page
The protocol debug page provides Topic, message content, a Publish button, and a result area. Diagnose connections and subscriptions using device settings, variable values, and device logs.
| Function | Purpose |
|---|---|
| Topic / message content | Enter the topic and payload. Topic is required; the payload is limited to 64 KiB of UTF-8 bytes. |
| Publish | Submit a send through the current runtime socket. This does not create an independent publisher or inject data into variables. |
| Debug result | View the send request’s return or error, then check the actual message at the peer. |

Debugging notes
Sub and Pull are receive-only types; use an independent Publisher or Push peer to test collection. Pair Router with Dealer and use the frame format on this page. A Publish result does not verify receiving or variable mapping.
Verify the configuration
- Match endpoint, socket types, and Bind/Connect roles on both sides; only one side binds the endpoint.
- Configure a read-only variable with
SubscribeTopic=device/data;Path=$.Temperature. - Send two frames from the paired sender: Topic
device/dataand UTF-8 body{"Temperature":25.6}. Confirm numeric value25.6and a new collection time. - For a variable with a condition script, send a rejected message and confirm it does not update the value.
- Observe the high-water mark and logs under the intended message rate, checking for delays or loss.
Troubleshooting
- Publishing or receiving fails: check the endpoint, socket type, Bind/Connect role, and firewall. Only one side may bind.
- The device is online but variables do not update: check the actual Topic, variable topic prefixes, payload fields, and condition script.
- Missing values: check JSONPath and property names. Missing paths and ambiguous case-insensitive matches leave the value unchanged. Topic plus JSON in one text frame is not two frames; Router also includes identity and empty delimiter frames.
- Condition variables do not update: check the script, parameter types, and script errors in the log. Script errors reject the update.
- A Connect socket appears online but the peer receives nothing: this state only confirms socket setup, not peer reachability. Confirm message logs on both ends.
- Messages are delayed or lost: compare sender and receiver rates with the high-water mark, and reduce the test rate if needed.
- The debug send does not reach the peer: confirm that the current socket supports the send pattern and inspect peer logs.
Sub/Pullreception must be tested from their paired sender.
Related links
- Collection configuration: View channel, device and common variable configuration.
- Plugin Index: Find other collection or data-forward plugins.