Skip to main content

ZeroMQ Producer

Purpose

This target publishes gateway variables, devices, alarms, and plugin events through a ZeroMQ socket.

Configure the forwarding group and target through Data Forwarding. This page covers the ZeroMQ endpoint, socket mode, high-water mark, Topic templates, and debug verification.

Open the plugin

Open Development Configuration → Data Forwarding and:

  1. Save the forwarding-group range, trigger, interval, online filter, and batching.
  2. Add a target, choose ZeroMQ Producer, and fill in the basic target information.
  3. Open Target properties and configure the endpoint, socket type, bind mode, high-water mark, Topics, templates, and cache.
  4. Save and enable the target, start a matching test receiver, and use target debug.

Basic target information

SettingDefaultConfiguration
Group-Select a saved forwarding group.
Target name-Required and unique within the group.
EnableEnabledDisable to avoid creating a ZeroMQ socket.
Log levelInfoTemporarily use Debug for endpoint or send diagnostics.
Start timeout60 secondsValid range is 1 to 3600 seconds.

Target properties

Connection and capacity

SettingDefaultConfiguration
Connection addresstcp://127.0.0.1:5555ZeroMQ endpoint such as tcp://host:port or ipc://file. Both sides must use the same endpoint.
Socket typePubCurrent choices are Pub (publisher/subscriber), Push (push/pull), and Dealer (asynchronous request/reply). The receiver must use the compatible socket type.
Bind modeEnabledEnabled calls Bind; disabled calls Connect. Only one side may bind an endpoint.
High-water mark1000Outbound socket queue limit. A slow receiver can reach this limit and cause blocking or drops.

Socket-level send success does not confirm peer receipt. Use Dealer with an application-level ACK when end-to-end confirmation is required.

Topic templates

SettingDefaultConfiguration
Device Topic templateEmptyDevice message prefix/Topic; empty disables device records.
Variable Topic templateThingsGateway/VariableVariable prefix/Topic; ${DeviceName} and ${Name} may be used.
Alarm Topic templateEmptyAlarm prefix/Topic; empty disables alarm records.
Plugin-event Topic templateEmptyPlugin-event prefix/Topic; empty disables plugin-event records.

${field} must exist on the corresponding entity or script result. The forwarding group controls membership; Topic controls category and receiver subscription.

Target-variable properties

ZeroMQ inherits Data1 to Data10, optional text fields that are empty by default and are not added to messages automatically. Configure membership, aliases, trigger, and batching in Data Forwarding.

SettingDefaultConfiguration
Data1 to Data10EmptyProject-specific metadata; reference explicitly from a script or upload template when needed.

Data and scripts

SettingDefaultConfiguration
Detail logDisabledEnable briefly to inspect sends.
JSON indentationEnabledDisable to reduce payload size.
Ignore JSON nullsEnabledDisable when null fields must remain.
Device/variable/alarm/plugin-event list uploadEnabledDisable the relevant list switch for one message per entity.
Variable/alarm dictionary uploadDisabledApplies only to the corresponding list mode.
Entity scriptsEmptySelect saved scripts to transform entities before Topic and payload rendering.

Upload template fields

In Upload Template Configuration, choose Text or Json for each entity and insert ${field} placeholders. Empty content uses default JSON serialization; preview before saving. See Kafka Producer template fields.

Cache and capacity

SettingDefaultConfiguration
Enable failed-write retry cacheDisabledEnable to retain failed sends and replay after recovery.
Cache file maximum rows262144Maximum CacheDB outbox rows.
Upload chunk size2000Maximum records per replay batch.
Memory queue limit100000Maximum in-memory records before CacheDB handoff.
Filter offline dataDisabledFilters offline variables; the forwarding-group filter also applies.
Upload concurrency1ZeroMQ sockets are not thread-safe; the plugin reduces values above 1 to 1.
EntityAvailable fields
VariableId, Name, DeviceName, Value, CollectGroup, CollectTime, ChangeTime, IsOnline, DataType, Unit, RegisterAddress, Remark1
DeviceId, Name, ActiveTime, DeviceStatus, PluginName, Description, LastErrorMessage, Remark1
AlarmAlarmId, VariableId, Name, DeviceName, AlarmCode, AlarmLevel, AlarmLimit, AlarmText, RecoveryCode, AlarmTime, EventTime, AlarmType, EventType, Remark1
Plugin eventDeviceName, ObjectValue

Functions

FunctionPurpose
ZeroMQ protocol debugUse ZeroMQ protocol debug to send or inspect protocol frames and view the device or target response.

Target debug

Open Development Configuration → Data Forwarding, select the forwarding group and target, and open Debug.

ZeroMQ protocol panel

ZeroMQ Producer protocol debug panel

Check endpoint, bind mode, Topic, and publish result. Use a test subscriber while commissioning.

Verify the target

  1. Start a test ZeroMQ subscriber with the matching socket type and endpoint.
  2. Confirm that only one side binds the endpoint.
  3. Change one variable included in the forwarding group.
  4. Compare Topic, payload, and message count at the subscriber.
  5. Check target logs and the queue level when the receiver is slower.

Troubleshooting

SymptomCheck
Subscriber receives no messageEndpoint, socket type, bind mode, firewall, subscriber state, group range, and Topic template.
Address already in useOnly one process should bind the endpoint. Switch the other side to connect mode or use another endpoint.
Messages are delayed or droppedReceiver speed, high-water mark, network, and target log.
Topic is unexpectedTopic templates, ${key} fields, entity values, and the forwarding group target.
Payload is invalidTemplate preview, JSON syntax, placeholder names, and entity-script output.