ZeroMQ
The zeromq node-type exchanges messages via the ZMTP protocol.
It is similar to the nanomsg node-type.
ZeroMQ (also known as ØMQ, 0MQ, or zmq) looks like an embeddable networking library but acts like a concurrency framework. It gives you sockets that carry atomic messages across various transports like in-process, inter-process, TCP, and multicast. You can connect sockets N-to-N with patterns like fan-out, pub-sub, task distribution, and request-reply. It's fast enough to be the fabric for clustered products. Its asynchronous I/O model gives you scalable multicore applications, built as asynchronous message-processing tasks. It has a score of language APIs and runs on most operating systems. ZeroMQ is from iMatix and is LGPLv3 open source.
The zeromq node-type implements the publish/subscribe and radio/dish protocols.
Prerequisites
This node-type requires libzmq (>= 2.2.0).
Implementation
The source code of the node-type is available here: https://github.com/VILLASframework/node/blob/master/lib/nodes/zeromq.cpp
Configuration
Format Object (object) or Format Name (string) (format_spec) | |
| destinations | Array of strings <uri> [ items <uri > ] During startup connect to those WebSocket servers as a client. Each URI must use the following scheme:
It starts with a protocol which must be one of |
object (Input configuration (received by VILLASnode)) | |
| vectorize | integer Default: 1 This setting allows to send multiple samples in a single message to the destination nodes. The value of this setting determines how many samples will be combined into one packet. |
Array of Hook Object (object) or Hook Name (string) (hook_list) | |
| builtin | boolean (Builtin hook functions) Default: true By default, each node and paths has a couple of default hooks attached to them. With this setting the attachment of built-in hooks can be disabled. |
object (Output configuration (sent out by VILLASnode)) |
{- "format": "villas.human",
- "in": {
- "signals": [
- {
- "name": "tap_position",
- "type": "integer",
- "init": 0
}, - {
- "name": "voltage",
- "type": "float",
- "unit": "V",
- "init": 230
}
], - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}, - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
], - "builtin": true,
- "out": {
- "vectorize": 0,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}
}Example
nodes = {
zeromq_node = {
type = "zeromq"
# The ZeroMQ pattern. One of pubsub, radiodish
pattern = "pubsub"
# Enable IPv6 support
ipv6 = false
# Z85 encoded Curve25519 keys
curve = {
enabled = false
public_key = "Veg+Q.V-c&1k>yVh663gQ^7fL($y47gybE-nZP1L"
secret_key = "HPY.+mFuB[jGs@(zZr6$IZ1H1dZ7Ji*j>oi@O?Pc"
}
in = {
# The subscribe endpoint
# See http://api.zeromq.org/2-1:zmq-bind for details
subscribe = "tcp://*:1234"
# A filter which is prefix matched for each received msg
filter = "ab184"
}
out = {
# The publish endpoints
# See http://api.zeromq.org/2-1:zmq-connect for details
publish = [
"tcp://localhost:1235",
"tcp://localhost:12444"
]
# A prefix which is pre-pended to each message
filter = "ab184"
}
}
}