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.
Outbound frames
Attach the action to a send-capable socket such as PUB, PUSH, REQ, REP, PAIR, DEALER, or ROUTER.
SpEL payload
Interpolate event fields, task variables, or static text into a single UTF-8 frame using #{...} markers.
Event bridge
Attach the action to Event Manager rules to forward Banalytics events to ZeroMQ-aware processes and agents.
Adding a ZeroMQ send action
Select the ZeroMQ socket
Choose a ZeroMQSocketThing whose socket type can send messages in the chosen pattern (PUB, PUSH, REQ, REP, PAIR, DEALER, ROUTER).
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 }}.
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.
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
Publish telemetry
Use a PUB socket to broadcast detections, sensor values, or state updates to one or more subscribers.
Dispatch work
Use a PUSH socket to feed jobs into a worker pool that pulls items from the pipeline.
Request/reply
Use a REQ or REP socket only when both sides honor ZeroMQ's strict request-response alternation.
SUB or PULL will also fail because those sockets cannot send frames.
Blocking and timeout choices
sendTimeoutMs for the peer or the local queue to accept the frame.ZMQ.DONTWAIT. The send fails immediately when the socket cannot accept the frame; the action then reports a send error.PUB socket without subscribers silently drops messages, which is by design. Statistics still count the send as successful.PUSH socket queues frames when no PULL peer is connected. Tune sendTimeoutMs to avoid unbounded waits on a stalled consumer.Configuration parameters
| Parameter | Required | Description | Default |
|---|---|---|---|
Title | Yes | Display name of the action inside Banalytics. | None |
ZeroMQ Socket | Yes | Reference to a ZeroMQSocketThing used to send the message. | None |
Message Template | Yes | Payload 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 | Yes | Sets ZMQ.DONTWAIT on the send call. Enable when the action must never wait on a slow or absent consumer. | false |
Operational notes
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 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.
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.
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-safe evaluation
A template that evaluates to null is treated as an empty string, so the socket still receives a zero-length 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.