Getting Started Cameras & Video Detection & Recording Automation & Events Actions Integration & Connectivity Network & Discovery AI & Remote Control MQTT Modbus ZeroMQ System & Administration Use Cases Troubleshooting About & Legal
Home / Documentation / ZeroMQ Socket Listener
Knowledge base

ZeroMQ Socket Listener

ZeroMQSocketListenerTask receives messages from a configured ZeroMQSocket and turns them into Banalytics processing input. Use it for real-time telemetry, commands, external AI results, industrial gateways, and custom sidecar agents.

Receive ZeroMQ frames and route them into Banalytics workflows

The listener runs continuously on a background daemon thread. Each received frame can fire a ZeroMQEvent or be passed to child tasks through the execution context variable zmq-payload.

IN

Inbound messages

Attach the task to a receive-capable socket such as SUB, PULL, REP, PAIR, DEALER, or ROUTER.

EVT

Events

Enable fireZMQEvent when Event Manager rules should react to each incoming message.

CTX

Child tasks

Keep event firing disabled when a local processing chain should consume zmq-payload directly.

Choose event-driven or child-task processing

EVT

Event-driven automation

Set fireZMQEvent=true when messages should trigger Event Manager rules, notifications, actions, or state transitions.

PIPE

Local processing pipeline

Set fireZMQEvent=false when child tasks should process every message without creating a global event for each frame.

TEXT

Text and JSON payloads

Keep stringPayload=true for JSON, CSV, plain text commands, line protocols, and expression-friendly rule conditions.

BIN

Binary payloads

Set stringPayload=false for images, protobuf, msgpack, compressed messages, or any protocol where raw bytes must be preserved.

Common listener topologies

SUB telemetry
Listen to a publisher that broadcasts sensor values, AI detections, or state updates.
PULL worker
Receive a queued stream from PUSH producers and run Banalytics tasks for every item.
REP endpoint
Use only when the companion process follows request/response ordering and the workflow provides the expected reply behavior.
Advanced routing
Use PAIR, DEALER, or ROUTER only with an external protocol that defines identities, frames, and routing rules.

Configuration parameters

ParameterRequiredDescriptionDefault
ZeroMQ Socket
YesReference to the ZeroMQSocket used for receiving messages.None
Generate event
YesFires a ZeroMQEvent with code EVT_ZEROMQ_MESSAGE for each received message.false
String message
YesConverts received bytes to a UTF-8 String. Disable it to keep the payload as raw byte[].true
Reconnect on idle timeout
YesIdle threshold in milliseconds before the task reports a socket processing problem and restarts through component lifecycle handling. Use 0 for very sporadic sources.30000

Interpret ZeroMQEvent and zmq-payload

When fireZMQEvent=true, the task emits ZeroMQEvent. Its payload field is either a String or byte[], depending on stringPayload. Child tasks can also read the same message from zmq-payload, even when global event firing is disabled.

ModePayload typeBest forHow to use
stringPayload=true
StringJSON, commands, CSV, numeric text, line protocol, Event Manager expressions.Use payload in rules
stringPayload=false
byte[]Images, protobuf, msgpack, compressed data, custom binary frames.Parse in JavaTask
zmq-payload
ObjectExecution context variable available to child tasks started by the listener.Pipeline input
Expression examples: with stringPayload=true, Event Manager conditions can check values such as payload == 'START', payload.startsWith('cmd:'), or payload.contains('"alarm":true').
Object payload = ctx.getVar("zmq-payload");
if (payload instanceof String text) {
    // Parse JSON, command text, CSV, or a line protocol value.
} else if (payload instanceof byte[] bytes) {
    // Decode binary payload in a custom parser or JavaTask.
}

Operational notes

TYPE

Use a receive-capable socket

A listener is useful for inbound patterns. A pure PUB or PUSH sending socket will not provide messages to receive.

IDLE

Calibrate idle recovery

For continuous streams, keep idleReconnectMs near the expected message cadence. For rare messages, set it to 0 or a much larger value.

LOAD

Control event volume

Broad subscriptions and high-frequency publishers can create many events or child executions. Narrow the socket filter or process messages in batches when needed.

FRAME

Frame boundaries matter

The listener handles one received frame at a time. If an external protocol uses multipart messages, assemble and interpret those frames explicitly in the companion workflow.

Related ZeroMQ pages

Related tasks and pages