forked from zeromq/rfc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec_3.txt
150 lines (107 loc) · 5.42 KB
/
spec_3.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
The ZeroMQ Device Configuration File format (ZDCF) specifies a standard syntax for configuring 0MQ devices. It provides information to configure a 0MQ context, and a set of 0MQ sockets. This specification aims to make it easier to share and reuse devices and build systems for device administration.
* Name: rfc.zeromq.org/spec:3/zdcf
* Editor: Pieter Hintjens <[email protected]>
* State: deprecated
++ License
Copyright (c) 2010 iMatix Corporation and contributors
This Specification is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This Specification is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses>.
++ Change Process
This Specification is a free and open standard[((bibcite fandos))] and is governed by the Digital Standards Organization's Consensus-Oriented Specification System (COSS)[((bibcite coss))].
++ Language
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119[((bibcite rfc2119))].
++ Goals
ZDCF aims to:
* Provide a standard reusable format for device configuration.
* Be as widely accessible as possible for different programming languages.
* Be platform neutral.
* Be easy to read and edit.
* Be lightweight to process.
* Cover all 0MQ context and socket configuration options.
++ Architecture
ZDCF is a JSON[((bibcite json))] format. A ZDCF file contains an optional context object and zero or more device objects. Conceptually, one ZDCF file maps to one process, consisting of a single context and zero or more device threads.
Here is a typical example of a ZDCF file:
[[code]]
{
"context": {
"iothreads": 1,
"verbose": true
},
"main" : {
"type": "queue",
"frontend": {
"option": {
"hwm": 1000,
"swap": 25000000
},
"bind": "tcp://eth0:5555"
},
"backend": {
"bind": "tcp://eth0:5556"
}
}
}
[[/code]]
This is also a valid ZDCF file:
[[code]]
{
}
[[/code]]
+++ The Context Object
The context object is optional and has these properties:
* Its name is "context".
* "iothreads" - (integer) - specifies the number of I/O threads for the context. Defaults to 1 if not specified.
* "verbose" - (Boolean) - if "true", the program parsing the JSON should output tracing information. Defaults to "false" if not specified.
+++ The Device Object
Device objects can occur zero or more times and have these properties:
* The name is any value except "context".
* "type" - (string) - specifies the device type. Types starting with "z" are reserved for built-in 0MQ devices. Other device types may be defined by the application as needed.
* Zero or more socket objects.
+++ The Socket Object
Socket objects can occur zero or more times within a device object, and have these properties:
* The name is any value except "type".
* "bind" - (string) - specifies zero or more endpoints to bind the socket to.
* "connect" - (string) - specifies zero or more endpoints to connect the socket to.
* "option" - (object) - specifies configuration of the socket.
+++ The Option Object
An option object is optional inside a socket object. It has these properties:
* Its name is "option".
* "hwm" - (integer) - specifies the ZMQ_HWM option.
* "swap" - (integer) - specifies the ZMQ_SWAP option.
* "affinity" - (integer) - specifies the ZMQ_AFFINITY option.
* "identity" - (string) - specifies the ZMQ_IDENTITY option.
* "subscribe" - (string) - specifies the ZMQ_SUBSCRIBE option.
* "rate" - (integer) - specifies the ZMQ_RATE option.
* "recovery_ivl" - (integer) - specifies the ZMQ_RECOVERY_IVL option.
* "mcast_loop" - (Boolean) - specifies the ZMQ_MCAST_LOOP option.
* "sndbuf" - (integer) - specifies the ZMQ_SNDBUF option.
* "rcvbuf" - (integer) - specifies the ZMQ_RCVBUF option.
See [http://api.zeromq.org/zmq_setsockopt.html zmq_setsockopt(3)] for details.
+++ Value Arrays
Properties may be specified as value arrays where it makes sense and at least for:
* The socket "bind" property.
* The socket "connect" property.
* The option "subscribe" property.
For example:
[[code]]
"frontend": {
"option": {
"subscribe": [ "10001", "10002" ]
},
"bind": [ "tcp://eth0:5555", "inproc://device" ]
}
[[/code]]
+++ Built-in Device Types
The built-in device types that exist at time of writing are:
* "zqueue" - ZMQ_QUEUE
* "zforwarder" - ZMQ_FORWARDER
* "zstreamer" - ZMQ_STREAMER
See [http://api.zeromq.org/zmq_device.html zmq_device(3)] for details.
++ References
[[bibliography]]
: rfc2119 : "Key words for use in RFCs to Indicate Requirement Levels" - [http://tools.ietf.org/html/rfc2119 ietf.org]
: json : "Introducing JSON" - [http://json.org/ json.org]
: fandos : "Definition of a Free and Open Standard" - [http://www.digistan.org/open-standard:definition digistan.org]
: coss : "Consensus Oriented Specification System" - [http://www.digistan.org/spec:1/COSS digistan.org]
[[/bibliography]]