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

ZeroMQ Send Action

ZeroMQSendAction publishes outbound messages through a configured ZeroMQSocketThing. The payload is evaluated as a Spring SpEL template expression against the action ExecutionContext, so runtime values such as the triggering event, upstream variables, or current state can be interpolated into the message before it is sent on the socket.

Push Banalytics decisions onto a ZeroMQ socket

The action takes a SpEL-based message template and a non-blocking flag. On start it parses the template; on each invocation it evaluates it against the current execution context, encodes the result as UTF-8, and calls ZeroMQSocketThing#send. The action fails fast when the referenced socket is not active or when ZeroMQ rejects the frame.

OUT

Outbound frames

Attach the action to a send-capable socket such as PUB, PUSH, REQ, REP, PAIR, DEALER, or ROUTER.

TPL

SpEL payload

Interpolate event fields, task variables, or static text into a single UTF-8 frame using #{...} markers.

RULE

Event bridge

Attach the action to Event Manager rules to forward Banalytics events to ZeroMQ-aware processes and agents.

Adding a ZeroMQ send action

01

Select the ZeroMQ socket

Choose a ZeroMQSocketThing whose socket type can send messages in the chosen pattern (PUB, PUSH, REQ, REP, PAIR, DEALER, ROUTER).

02

Enter the SpEL message template

Plain text outside #{...} markers is sent verbatim. Inside markers, expressions are evaluated against the current execution context, for example #{ #event.sourceTitle } or {"src":"#{ #event.sourceTitle }","ts":#{ #event.dateTime?.time }}.

03

Decide on blocking behavior

Leave Non-blocking send off for normal use. Enable it to use ZMQ.DONTWAIT when the action must never wait on a slow consumer, accepting that the send call may fail immediately if the socket cannot accept data.

04

Wire it to a trigger

Place the action under an Event Manager rule or another task chain. Each invocation evaluates the template and pushes one ZeroMQ frame through the referenced socket.

Common ZeroMQ sending scenarios

PUB

Publish telemetry

Use a PUB socket to broadcast detections, sensor values, or state updates to one or more subscribers.

PUSH

Dispatch work

Use a PUSH socket to feed jobs into a worker pool that pulls items from the pipeline.

RPC

Request/reply

Use a REQ or REP socket only when both sides honor ZeroMQ's strict request-response alternation.

Socket compatibility: the action will throw at runtime if the referenced socket is not active. Attaching it to a pure receiving pattern such as SUB or PULL will also fail because those sockets cannot send frames.

Blocking and timeout choices

Blocking
Default. The send waits up to the socket's sendTimeoutMs for the peer or the local queue to accept the frame.
Non-blocking
Uses ZMQ.DONTWAIT. The send fails immediately when the socket cannot accept the frame; the action then reports a send error.
PUB drops
A PUB socket without subscribers silently drops messages, which is by design. Statistics still count the send as successful.
PUSH queues
A PUSH socket queues frames when no PULL peer is connected. Tune sendTimeoutMs to avoid unbounded waits on a stalled consumer.

Configuration parameters

ParameterRequiredDescriptionDefault
Title
YesDisplay name of the action inside Banalytics.None
ZeroMQ Socket
YesReference to a ZeroMQSocketThing used to send the message.None
Message Template
YesPayload content. Evaluated as a Spring SpEL template expression against the action ExecutionContext; plain text is sent as-is, while #{...} markers are evaluated and interpolated.None
Non-blocking send
YesSets ZMQ.DONTWAIT on the send call. Enable when the action must never wait on a slow or absent consumer.false

Operational notes

RUN

Socket must be active

The action fails if the referenced ZeroMQSocketThing is not running when the action is invoked. Make sure the socket is started before the trigger fires.

SEND

Send failure handling

If ZeroMQ returns false from the send call, the action throws an exception, increments the socket's send error counter, and reports failure to its parent task chain.

TPL

SpEL template parsing

The Message Template is parsed on action start. A syntax error in the expression prevents initialization; fix the template before re-enabling the action.

CTX

Execution context variables

The template evaluates against a SpEL StandardEvaluationContext whose root object is the action ExecutionContext. Variables registered upstream with ctx.setVar("name", value) are accessible as #name; in event-driven rules, Event Manager exposes the triggering event as #event. Use safe-navigation (?.) for optional fields.

NULL

Null-safe evaluation

A template that evaluates to null is treated as an empty string, so the socket still receives a zero-length frame.

FRAME

Single-frame messages

The action sends one frame per invocation. Multipart framing is not produced here; if a peer expects multipart messages, prepare them in a custom task or process accordingly.

Related ZeroMQ pages

Related tasks and pages