On this page
Gateway MQTT collection client
This plugin is used on a central Gateway to collect variables from multiple edge Gateways through one shared MQTT broker connection.
It is not a general MQTT JSON collector. It accepts the current TGateway Gateway MQTT protocol and uses RemoteKey to separate each edge Gateway’s variables, devices, online state, snapshots, and remote writes.
Compatible devices and models
| Device series / model examples | Connection requirements |
|---|---|
| TGateway gateway data publishers | Connect to the publisher MQTT service using TGateway topics and message structure. Use MQTT collection plugins for generic device JSON messages. |
Synchronize one edge variable to the center
This example uses source edge-01 and the edge device Collect_OPC_UA variable Ramp1: Int32, read-only and continuously changing. Its remote directory ID is 877079827984453. Copy the actual ID from your own remote directory.
- Confirm the edge variable has a current value. Create the forwarding group below, add Ramp1, and enable both the group and its MQTT client forwarding target.
- Add this collector under No channel at the center. Both sides connect to the same Broker. Here the endpoint is
127.0.0.1:18886, with distinct Client IDscollect-central-01andcollect-edge-01-uplink. On separate computers, replace loopback with the reachable Broker address. - Add enabled source
edge-01, save and enable the collector. Select the source in Protocol debug → Remote gateways and request a snapshot. Open Remote variables and compare the device, Ramp1, Int32 and ReadOnly fields.

- Use Synchronize current remote for the source. Review additions, updates and conflicts under Variable synchronization. This plan adds one variable with zero conflicts. Check the source and plan, then click Confirm and apply before the confirmation deadline; preview again if it expires.

- Open the new mirror in Realtime variables. Its address is
edge-01/877079827984453; Int32 and ReadOnly match the directory. The local ID877119118921797is different and must not replace the remote ID. Watch the value and collection time update with the source; the instantaneous number in the image is not a fixed expected value.

| Mirror setting | Behavior |
|---|---|
| Address | RemoteKey/RemoteVariableId; a display name, Topic or PLC register is not a substitute. |
| Data type | Automatic synchronization uses the remote declaration. Use Object only for a source object, not for every remote point. |
| Access | New mirrors default to read-only. Remote writing also requires the center switch, edge RPC and source-variable permissions. |
| Names | Review naming/address conflicts. Renaming a source preserves its ID; deleting and recreating it can produce a different ID. |
| Type changes | Refresh the directory and preview synchronization; inspect dependent expressions, alarms and forwarding configurations. Numeric 32 and string "32" have different meanings. |
| Timestamps | Values carry edge collection time. Synchronize clocks. Snapshot interval controls full-state refresh, while edge group settings control realtime publication. |
Snapshot, request and offline intervals are in seconds. 60/30/180 means a snapshot every 60 seconds, a 30-second request deadline and offline detection after 180 seconds without a valid source message. Offline timeout must exceed snapshot interval.
Choose the mode and data path
Choose a Mode
| Mode | Use When | Central Gateway | Edge Gateways |
|---|---|---|---|
| Gateway MQTT collection client | A shared Broker already exists, or every Gateway can only make outbound connections | Uses one persistent ClientId and subscribes to all configured sources | Multiple MQTT Client Forwarding targets connect to the same Broker and publish under their own RemoteKey |
| Gateway MQTT collection server | The central Gateway can expose an inbound MQTT port | Listens on one port and binds each edge session to a ClientId, credentials, and optional certificate fingerprint | Multiple MQTT Client Forwarding targets connect directly to the central Gateway |
Prepare the Deployment
- Assign every edge Gateway a stable
RemoteKeycontaining only ASCII letters, digits, hyphens, or underscores. - Use the same Topic root on the collector and all edge producers. The default is
TGateway/Gateway. - Create a MQTT Client Forwarding target on the Data Forwarding page of every edge Gateway, keep Retain disabled, and configure the variable, data-request, and RPC Topics as described below.
- For remote writes, enable permissions on the edge producer, the central collector, and the target variable.
- Enable TLS according to the network policy. In Server mode, configure unique credentials for every source. If certificate fingerprints are enabled, bind a different certificate to each source.
Complete Data Path
Gateway MQTT collection client and Gateway MQTT collection server run only on the central Gateway and perform inbound collection. MQTT upload from each edge Gateway continues to use the existing MQTT Client Forwarding data-forwarding plugin. No second Gateway-specific producer plugin is required.
Collected variables on an edge Gateway
→ Data-forwarding group (selects scope and trigger mode)
→ MqttClientProducer (uploads values and handles snapshot/write requests)
→ Shared Broker or the central Gateway MQTT listener
→ GatewayMqttCollectClient / GatewayMqttCollectServer
→ Mirror variables on the central GatewayClient and Server in the plugin names describe the MQTT role of the central collector, not the data direction. In Client mode, the central collector connects to a shared Broker. In Server mode, the central collector listens and each edge MQTT Client Forwarding connects to it.
Configure MQTT Upload on Each Edge
Perform these steps on every edge Gateway:
- In Development configuration → Data forwarding, create enabled group
Edge01_Upload. Choose manual variable selection and change triggering. Add the source in the next step; creating the group alone does not select a variable.

- In Group variable configuration, add source device
Collect_OPC_UAand variableRamp1, enable it and save. Select the original edge point rather than the center mirror to avoid a forwarding loop.

- Create target
Edge01_Broker, select MQTT client forwarding, and enable it. Method-call permission and variable RPC writing are separate settings; method calls can remain disabled for collection.

- Under Plugin properties, enter the Broker endpoint, a unique Client ID, protocol and required credentials. This example uses TCP, MQTT 3.1.1 and
127.0.0.1:18886.

- Enter the fixed Topics below and leave Retain disabled. Use separate suffixes for write RPC, historical reads and snapshot requests.


- Under Data and scripts, enable variable-list upload, disable variable-dictionary upload and JSON Ignore Null, and leave the variable entity script empty. Save the target. Keep the default variable-list payload rather than replacing it with a custom value-only JSON object.

- When the target is online, request a snapshot at the center and preview and apply synchronization. If the directory is empty, check the saved group scope, variable-list upload and exact Topics first.
Endpoint Mapping
| Central Collection Mode | Edge MQTT Client Forwarding Endpoint | Identity Configuration |
|---|---|---|
| Gateway MQTT collection client | Enter the shared Broker address and port. The central collector connects to the same Broker | Use a unique edge ClientId and the Broker account assigned to this edge. Broker ACLs should restrict the edge to its own {TopicRoot}/{RemoteKey}/# namespace |
| Gateway MQTT collection server | Enter the central Gateway address and the listener port configured by Gateway MQTT collection server | ClientId must equal the source’s AllowedClientId; username and password must also exactly match that source configuration |
Do not use MQTT Server Forwarding on the edge. Client collection requires both sides to connect to one shared Broker, while Server collection requires an edge client to connect to the central listener. MQTT Client Forwarding is the connection initiator in both topologies.
Fixed Topics and Payload Shape
If the collector Topic root is TGateway/Gateway and this edge uses RemoteKey=edge-01, configure its MQTT Client Forwarding as follows:
| Edge Property | Value or Requirement |
|---|---|
| Variable Topic Template | TGateway/Gateway/edge-01/Variable |
| Data Request Topic | TGateway/Gateway/edge-01/RpcQuest |
| RPC Write Topic | TGateway/Gateway/edge-01/RpcWrite |
| Historical Read RPC Topic | TGateway/Gateway/edge-01/RpcHistory; a valid non-empty prefix |
| Variable List Upload | Enabled |
| Variable Dictionary Upload | Disabled |
| Variable Entity Script / Upload Template | Empty; do not change the current fixed payload |
| JSON Ignore Null | Disabled |
| Retain Message | Disabled; dedicated collection rejects retained messages |
| Filter Offline Data | Disabled so a full snapshot includes offline variables and their metadata |
| QoS Level | Match the edge and the central source; AtLeastOnce is recommended. Repeated older values cannot overwrite current state, but historical backfill can contain duplicates |
| Upload Shard Size | Greater than 0, with each JSON batch kept below the collector’s Inbound Payload Byte Limit |
RemoteKey is not a separate MQTT Client Forwarding property. It is embedded in the fixed Topics above. Every edge Gateway must use a different RemoteKey. Do not use ${...} placeholders in these Topics, and do not change the payload through an entity script or upload template. The dedicated collector does not issue historical-read RPC requests, but the edge forwarding target still requires a valid non-empty prefix in that field. The images use QoS 0; change both the source and target when using QoS 1.
Backfill the central history database
Enable the Edge’s failed-send retry cache, include mapped central variables in an enabled forwarding group, and configure a Historical Data Storage target. Every received sample retains its source value, CollectTime and CreateTime. A list may contain multiple samples for the same variable. Late values do not roll back current state, and unchanged values can still enter history. ChangeTime remains available for custom processing but is not a separate standard history column.
The fixed payload requires CreateTime, CollectTime and ChangeTime as Unix millisecond timestamps; the default Edge variable list supplies them. Backfill stores the processed Edge value without reapplying the center’s read expression. Central scope, enable state and online filtering apply. Scheduled central collection adds local snapshots; use change triggering when only source records are needed.
The Edge cache covers Edge publishing failures. If the shared Broker has acknowledged publication while the central subscriber is offline, delivery also requires a stable central ClientId, a persistent session and suitable Broker offline queues. MQTT publication acknowledgement is not database commit confirmation. QoS redelivery and reconnect snapshots may duplicate history. The general MQTT Collection Client updates variables at receipt time and does not provide this source-time backfill. See Offline cache and historical backfill for capacity and database time columns.
Check the center’s Messages per second limit and concurrent processing capacity for replay peaks. Messages beyond these limits are rejected, and Broker-acknowledged messages do not automatically return to the Edge cache. Configure suitable batch sizes and publishing rates, then inspect rate-limit and rejection counters.
Configure the connection and remote variables
Open the plugin
Open Development Configuration → Collection Configuration, create one collection device, and select Gateway MQTT Collection Client.
This is a shared-connection plugin: configure multiple remote sources inside this one device. Do not create one ordinary MQTT channel or one Gateway MQTT device for every edge Gateway.
Configure the edge target as described in Configure MQTT Upload on Each Edge.

Enter the shared Broker connection under Plugin properties. Use different center and edge Client IDs.

Connection and security
| Setting | Description |
|---|---|
| Connection type | Default Tcp. Select TCP or WebSocket according to the shared broker. |
| IP address | Default localhost. Host name or IP address of the shared broker. |
| Port | Default 1883. Broker port. |
| WebSocket path | Default /mqtt. Used only for WebSocket connections. |
| Client ID | Persistent client ID for the central collector. It must be unique on the broker. |
| Clean session | Default enabled. Controls the shared MQTT session state. |
| MQTT version | Default 4 (MQTT 3.1.1). Must match the broker. |
| Enable SSL | Enables TLS for the shared connection. |
| SSL target host | Host name used for certificate validation. |
| Client certificate / CA certificate | Select the trusted Broker CA for TLS. Select a client identity only if the Broker requires mutual TLS. |
| Allow untrusted certificate | Temporary commissioning option. Disable it in production. |
| SSL protocol / revocation check | TLS and certificate-revocation controls required by the broker. |
| Username / password | Credentials for the central collector on the broker. |
| Keep-alive | Default 60 seconds. |
| Connection timeout | Default 3000 ms. |
Remote sources and protocol
| Setting | Description |
|---|---|
| Topic root | Default TGateway/Gateway. It must be identical on the central collector and all edge forwarding targets. |
| Remote source | Opens the source list. Add one source for each edge Gateway. |
| RemoteKey | Stable identifier used in topics, variable addresses, snapshot requests, and RPC. It must be unique and contain only ASCII letters, digits, hyphens, or underscores. |
| Display name | Human-readable source name shown in the debug page. |
| Enable | Enables subscription, snapshots, catalog updates, and RPC for this source. |
| QoS | QoS used by this source’s fixed protocol messages. |
| Allow remote write | Enables write requests from the central collector to edge variables. Keep it disabled unless required. |
| Snapshot interval | Default 60 seconds; range 10–3600. Periodic full catalog snapshot interval. |
| Request timeout | Default 30 seconds; range 1–600. Timeout for snapshot and RPC requests. |
| Offline timeout | Default 180 seconds. Must be greater than the snapshot interval. |
Each remote source must have a different RemoteKey. The collector uses one shared MQTT session, while source identity is carried by the protocol namespace.
Open the remote-source editor and add enabled source edge-01. Match the source key to the Topic namespace.

Match the Topic root and leave remote writing disabled while setting up collection.

Capacity limits
| Setting | Default | Description |
|---|---|---|
| Remote source limit | 32 | Maximum configured edge sources for this device. |
| Snapshot concurrency | 4 | Maximum simultaneous snapshot or synchronization tasks. |
| Inbound payload limit | 1048576 bytes | Maximum size of one incoming MQTT payload. |
| Messages per second | 200 | Total message rate entering the parser. |
| Inbound handler concurrency | 4 | Maximum concurrent JSON handlers. |
| JSON depth limit | 64 | Maximum accepted protocol JSON nesting depth. |
| Per-source catalog limit | 100000 | Maximum variables in one edge source catalog. |
| Total catalog limit | 300000 | Maximum variables across all sources. It must cover one source limit. |
| Pending RPC limit | 256 | Maximum simultaneous remote RPC batches. |
| Detailed log | Disabled | Enables protocol summaries without full sensitive payloads. Disable after commissioning. |
Increase limits only after checking memory, broker traffic, and the number of edge sources.
Address rule
Use the remote source key and remote variable ID:
{RemoteKey}/{RemoteVariableId}Example: edge-01/877079827984453 for the remote Ramp1 point on this page.
The variable ID is the ID reported by the edge Gateway. Do not replace it with the local mirror variable ID.
Debug and verify
Device debug
Open Development Configuration → Collection Configuration, select the Gateway MQTT device, open Protocol Debug at the top of the workspace.

Use Remote gateways to check source connectivity and request snapshots; Remote variables to inspect the source catalog; Variable synchronization to review and apply local changes; and Diagnostics to identify rejected messages or RPC failures.
Write an edge variable from the center
Ramp1 is read-only. Create a separate writable Setpoint to follow the complete path from the central write through the edge protocol to the peer value. The central mirror uses the remote variable ID, not a Modbus address.
- Prepare the edge data source. In Modbus Slave 7.4.1 → Setup → Slave Definition (F8), set Slave ID
1, function03 Holding Register (4x), decimal address0and quantity100. Zero-based offset2in this example corresponds to40003in the Modbus master.
- In Connection → Connect, select Modbus TCP/IP and listen on
127.0.0.1:15020. Use the tool computer’s actual IP when it runs separately from the edge Gateway. Follow Modbus Master to create the edge TCP client channel and station1device.
- Add
Setpointunder edge deviceEdge_Modbus_Setpoint: address40003, typeInt16, array length1and Read/Write access. Enable its RPC write switch further down the form, save it and include it inEdge01_Upload. Keep the edge target’s write TopicTGateway/Gateway/edge-01/RpcWrite.
- Enable Allow remote write in the central client’s Plugin properties and save the device. This device switch does not change individual variable permissions.
- Request a full snapshot in Protocol debug → Remote gateways, then synchronize this source. Review additions, updates and conflicts in Variable synchronization before Confirm and apply. This plan adds
Setpointand leaves the existingRamp1unchanged.
- Edit the new mirror. Its address is
edge-01/877159968292933, using the edge Setpoint ID after the slash. Keep the synchronizedInt16scalar configuration, change local access to Read/Write and enable the mirror’s RPC write switch. New synchronized points default to read-only with RPC write disabled; writable source metadata does not open local permissions automatically.
- Filter Realtime variables by
Setpoint, select Write, enter integer43and submit after the form recognizes it as a number. Use the source type for strings andtrue/falsefor Boolean values; arrays must match the source element type and count.
- After success, read back the mirror and check zero-based address
2in Modbus Slave. Both should show43. A value merely entered into the central dialog does not show the peer’s actual value.
For write disable, check Read/Write and RPC write permissions on both the mirror and source. For RPC timeouts, inspect source connectivity, fixed Topics, edge responses and central diagnostics. After editing a variable, let a new snapshot or upload initialize the mirror before assessing its collection state.
Troubleshooting
| Symptom | Check |
|---|---|
| Shared connection cannot start | Broker address, port, Client ID, credentials, TLS, CA certificate, and broker ACL. |
| Source remains offline | RemoteKey spelling, Topic root, edge target state, snapshot interval, and edge protocol messages. |
| Catalog is empty | Edge forwarding range, variable-list upload, snapshot response, payload limit, and catalog limits. |
| Values from sources are mixed | Every source must use a unique RemoteKey; every mirror address must use the matching RemoteKey. |
| Snapshot times out | Edge target connectivity, request timeout, message rate, inbound payload size, and broker traffic. |
| Remote write fails | Central and edge remote-write switches, source metadata permission, local variable permission, and RPC response logs. |
| Source becomes degraded | Offline timeout, snapshot completion, edge reconnect state, and diagnostics. |
Related links
- Gateway MQTT Collection Server: Server-mode listener properties.
- Collection Configuration: Common device, variable, import, and debug operations.
- Plugin Manual Index: Other collection and data-forwarding plugins.










