aboutsummaryrefslogtreecommitdiffstats
path: root/_sources/protocol.rst.txt
diff options
context:
space:
mode:
authorjason2017-01-23 20:18:42 -0700
committerjason2017-01-23 20:18:42 -0700
commitf3c64b9a0837dd03584b67179267e1e0ca8edadd (patch)
tree4b282f228902334e13415547f9d3ff8e9889d0d4 /_sources/protocol.rst.txt
parent4780da086a62543c2bfbf0b98cabc181c4420244 (diff)
downloadeventmq-f3c64b9a0837dd03584b67179267e1e0ca8edadd.tar.gz
eventmq-f3c64b9a0837dd03584b67179267e1e0ca8edadd.zip
update docs
Diffstat (limited to '_sources/protocol.rst.txt')
-rw-r--r--_sources/protocol.rst.txt260
1 files changed, 260 insertions, 0 deletions
diff --git a/_sources/protocol.rst.txt b/_sources/protocol.rst.txt
new file mode 100644
index 0000000..66b6829
--- /dev/null
+++ b/_sources/protocol.rst.txt
@@ -0,0 +1,260 @@
1******************************
2EventMQ Protocol Specification
3******************************
4*The status of this document is alpha and subject to heavy change*
5
6Goals
7=====
8The EventMQ Protocol (eMQP) defines a reliable service-oriented request-reply and pub-sub dialog between a set of clients, a broker, and a set of workers.
9
10The goals are to:
11
12 * Specify a protocol to follow when implementing a component to EventMQ.
13 * Allow requests to be routed to workers by an abstracted service name (named queues).
14 * Detect disconnected peers through heartbeating.
15 * Allow for message tracing and debugging.
16
17
18License
19=======
20This Specification is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any later version.
21
22This 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 Lesser General Public License for more details.
23
24Language
25========
26The 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[[1](http://tools.ietf.org/html/rfc2119)].
27
28Architecture
29============
30insert pretty picture here
31
32Topology
33--------
34eMQP connects a set of client applications (e.g. web servers), a broker, and a pool of workers. Clients connect to the broker as well as the workers.
35
36'Clients' is defined as application issuing requests and 'workers' as applications that process these requests. (Workers consist of a `JobManager` and a pool of `Worker` resources where the job executes.)
37
38The EventMQ broker handles a set of named queues. The broker SHOULD serve clients on a fair request and MAY deliver requests to workers on any basis, including 0MQ's built-in round robin or least-recently used.
39
40ROUTER Addressing
41-----------------
42In the case of request-reply, the broker MUST use a ROUTER socket to accept requests from both clients and workers. The broker MAY use a seperate socket implementing a subset of eMQP, or MAY use a single socket implementing all of eMQP.
43
44From the 0MQ manual[[2](http://api.zeromq.org/master:zmq-socket)]
45> When receiving messages a ROUTER socket shall prepend a message part containing the identity of the originating peer to the message before passing it to the application. When sending messages a ROUTER socket shall remove the first part of the message and use it to determine the identity of the peer the message shall be routed to.
46
47This extra frame is not shown in the specifications below.
48
49Global Frames
50-------------
51An **ACK** command consists of a 4-frame multipart message, formatted as follows.
52
53====== ============== ===========
54FRAME Value Description
55====== ============== ===========
560 _EMPTY_ leave empty
571 eMQP/1.0 Protocol version
582 ACK command
593 _MSGID_ A unique id for the msg
604 _MSGID_ The message id of the message this ACK is acknowledging
61====== ============== ===========
62
63A **REPLY** frame consists of a 5-frame multipart message, formatted as follows.
64
65====== ============== ===========
66FRAME Value Description
67====== ============== ===========
680 _EMPTY_ leave empty
691 eMQP/1.0 Protocol version
702 REPLY command
713 _MSGID_ A unique id for the msg
724 _MSG_ The reply to respond with
73====== ============== ===========
74
75A **HEARTBEAT** frame consists of a
76
77====== ============== ===========
78FRAME Value Description
79====== ============== ===========
800 _EMPTY_ leave empty
811 eMQP/1.0 Protocol version
822 HEARTBEAT command
833 _MSGID_ A unique id for the msg
844 _UNIX_TS_ A unix timestamp
85====== ============== ===========
86
87A **DISCONNECT** frame consists of
88
89====== ============== ===========
90FRAME Value Description
91====== ============== ===========
920 _EMPTY_ leave empty
931 eMQP/1.0 Protocol version
942 DISCONNECT command
953 _MSGID_ A unique id for the msg
96====== ============== ===========
97
98A **KBAI** frame consists of
99
100====== ============== ===========
101FRAME Value Description
102====== ============== ===========
1030 _EMPTY_ leave empty
1041 eMQP/1.0 Protocol version
1052 KBAI command
1063 _MSGID_ A unique id for the msg
107====== ============== ===========
108
109eMQP / Client
110-------------
111A **REQUEST** command consists of a 7-frame multipart message, formatted as follows.
112
113====== ============== ===========
114FRAME Value Description
115====== ============== ===========
1160 _EMPTY_ leave empty
1171 eMQP/1.0 Protocol version
1182 REQUEST command
1193 _MSGID_ A unique id for the msg
1204 _QUEUE_NAME_ the name of the queue the request should be sent to
1215 _HEADERS_ dictionary of headers. can be an empty set
1226 _MSG_ The message to send
123====== ============== ===========
124
125A **PUBLISH** command consists of a 7-frame multipart messag, formatted as follows.
126
127====== ============== ===========
128FRAME Value Description
129====== ============== ===========
1300 _EMPTY_ leave empty
1311 eMQP/1.0 Protocol version
1322 PUBLISH command
1333 _MSGID_ A unique id for the msg
1344 _TOPIC_NAME_ the name of the topic this message should be published across
1355 _HEADERS_ csv list of headers
1366 _MSG_ The message to send
137====== ============== ===========
138
139A **SCHEDULE** command consists of a 7-frame multipart message, formatted as follows.
140
141====== ============== ===========
142FRAME Value Description
143====== ============== ===========
1440 _EMPTY_ leave empty
1451 eMQP/1.0 Protocol version
1462 SCHEDULE command
1473 _MSGID_ A unique id for the msg
1484 _QUEUE_NAME_ name of queue that the job should run in
1495 _HEADERS_ csv list of headers for this message
1506 _MSG_ The message to send
151====== ============== ===========
152
153An **UNSCHEDULE** command consists of a 7-frame multipart message, formatted as follows.
154
155====== ============== ===========
156FRAME Value Description
157====== ============== ===========
1580 _EMPTY_ leave empty
1591 eMQP/1.0 Protocol version
1602 UNSCHEDULE command
1613 _MSGID_ A unique id for the msg
1624 _QUEUE_NAME_ ignored for this command, broadcasted to all queues
1635 _HEADERS_ csv list of headers for this message
1646 _MSG_ The message to send
165====== ============== ===========
166
167eMQP / Scheduler
168----------------
169An **INFORM** command consists of a 6-frame multipart message, formatted as follows.
170
171====== ============== ===========
172FRAME Value Description
173====== ============== ===========
1740 _EMPTY_ leave empty
1751 eMQP/1.0 Protocol version
1762 INFORM command
1773 _MSGID_ A unique id for the msg
1784 Queues. Unused for scheduler
1795 scheduler type of peer connecting
180====== ============== ===========
181
182eMQP / Worker
183-------------
184An **INFORM** command consists of a 5-frame multipart message, formatted as follows.
185
186====== ============== ===========
187FRAME Value Description
188====== ============== ===========
1890 _EMPTY_ leave empty
1901 eMQP/1.0 Protocol version
1912 INFORM command
1923 _MSGID_ A unique id for the msg
1934 _QUEUES_ csv seperated arrays containing an int and a string for weight and name. e.g. [40, 'email']
1945 worker type of peer connecting
195====== ============== ===========
196
197A **READY** frame consists of a 4-frame multipart message, formatted as follows.
198
199====== ============== ===========
200FRAME Value Description
201====== ============== ===========
2020 _EMPTY_ leave empty
2031 eMQP/1.0 Protocol version
2042 READY command
2053 _MSGID_ A unique id for the msg
206====== ============== ===========
207
208eMQP / Publisher
209----------------
210A **PUBLISH** frame consists of a 6-frame multipart message, formatted as follows.
211
212====== ============== ===========
213FRAME Value Description
214====== ============== ===========
2150 _EMPTY_ leave empty
2161 eMQP/1.0 Protocol version
2172 PUBLISH command
2183 _MSGID_ A unique id for the msg
2194 TOPIC A topic to publish to
2205 MSG Message to be published
221====== ============== ===========
222
223
224Heartbeating
225------------
226 * HEARTBEAT commands are valid at any time after an INFORM command.
227 * Any command except DISCONNECT act as a heartbeat. Peers SHOULD NOT send HEARTBEAT commands while sending other commands.
228 * Worker and broker MUST send heartbeats at regular and agreed-upon intervals.
229 * Scheduler and broker MUST send heartbeats at regular and agreed-upon intervals.
230 * If the worker detects that the broker disconnected it SHOULD restart the conversation.
231 * If the broker detects that a worker has disconnected it should stop sending it a message of any type.
232 * If the scheduler detects that the broker disconnects it SHOULD restart the conversation.
233
234Headers
235---------------
236Headers MUST be 0 to many comma seperated values inserted into the header field. If there are no headers required, an empty string MUST be sent where headers are required.
237
238Below is a table which defines and describes the headers.
239
240
241================= ======= ======= ======== ======= ===========
242Header REQUEST PUBLISH SCHEDULE Default Description
243================= ======= ======= ======== ======= ===========
244reply-requested X False Once the job is finished, send a reply back with information from the job. If there is no information reply with a True value.
245retry-count:# X 0 Retry a failed job this many times before accepting defeat.
246timeout:# X 0 Kill the job after X seconds, defaults to never timing out (0)
247guarantee X False Ensure the job completes by letting someone else worry about a success reply.
248nohaste X False When scheduling a job, set this to True if you don't want the job to run immediately as it's scheduled. Instead, it will run for the first time when the interval has elapsed.
249================= ======= ======= ======== ======= ===========
250
251DISCONNECT and KBAI
252===================
253When a component receives a DISCONNECT command it:
254 * MUST send a KBAI command to all connected components.
255 * MUST stop sending and receiving any messages
256 * MUST allow any pending messages or jobs to complete.
257
258When a component receives a KBAI command it:
259 * MUST stop sending any messages to the disconnecting component.
260 * SHOULD Clean up references to the disconnecting component.