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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
|
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EventMQ Protocol Specification — EventMQ 0 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="top" title="EventMQ 0 documentation" href="index.html"/>
<link rel="up" title="Contributing to EventMQ" href="contributing.html"/>
<link rel="prev" title="Contributing to EventMQ" href="contributing.html"/>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> EventMQ
</a>
<div class="version">
0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="api.html">API Documentation</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="contributing.html">Contributing to EventMQ</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="">EventMQ Protocol Specification</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#goals">Goals</a></li>
<li class="toctree-l3"><a class="reference internal" href="#license">License</a></li>
<li class="toctree-l3"><a class="reference internal" href="#language">Language</a></li>
<li class="toctree-l3"><a class="reference internal" href="#architecture">Architecture</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#topology">Topology</a></li>
<li class="toctree-l4"><a class="reference internal" href="#router-addressing">ROUTER Addressing</a></li>
<li class="toctree-l4"><a class="reference internal" href="#global-frames">Global Frames</a></li>
<li class="toctree-l4"><a class="reference internal" href="#emqp-client">eMQP / Client</a></li>
<li class="toctree-l4"><a class="reference internal" href="#emqp-worker">eMQP / Worker</a></li>
<li class="toctree-l4"><a class="reference internal" href="#heartbeating">Heartbeating</a></li>
<li class="toctree-l4"><a class="reference internal" href="#request-headers">Request Headers</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference external" href="https://github.com/enderlabs/eventmq">Source Code</a></li>
<li class="toctree-l2"><a class="reference external" href="https://github.com/enderlabs/eventmq/issues">Issues</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">EventMQ</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li><a href="contributing.html">Contributing to EventMQ</a> »</li>
<li>EventMQ Protocol Specification</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/protocol.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="eventmq-protocol-specification">
<h1>EventMQ Protocol Specification<a class="headerlink" href="#eventmq-protocol-specification" title="Permalink to this headline">¶</a></h1>
<p><em>The status of this document is alpha and subject to heavy change</em></p>
<div class="section" id="goals">
<h2>Goals<a class="headerlink" href="#goals" title="Permalink to this headline">¶</a></h2>
<p>The 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. This goal is to</p>
<p>The goals are to:</p>
<blockquote>
<div><ul class="simple">
<li>Specify a protocol to follow when implementing a component to EventMQ.</li>
<li>Allow requests to be routed to workers by an abstracted service name.</li>
<li>Detect disconnected peers through heartbeating.</li>
<li>Allow for message tracing and debugging.</li>
</ul>
</div></blockquote>
</div>
<div class="section" id="license">
<h2>License<a class="headerlink" href="#license" title="Permalink to this headline">¶</a></h2>
<p>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.</p>
<p>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.</p>
</div>
<div class="section" id="language">
<h2>Language<a class="headerlink" href="#language" title="Permalink to this headline">¶</a></h2>
<p>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[[1](<a class="reference external" href="http://tools.ietf.org/html/rfc2119">http://tools.ietf.org/html/rfc2119</a>)].</p>
</div>
<div class="section" id="architecture">
<h2>Architecture<a class="headerlink" href="#architecture" title="Permalink to this headline">¶</a></h2>
<p>insert pretty picture here</p>
<div class="section" id="topology">
<h3>Topology<a class="headerlink" href="#topology" title="Permalink to this headline">¶</a></h3>
<p>eMQP 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.</p>
<p>‘Clients’ is defined as application issuing requests and ‘workers’ as applications that process these requests. (Workers consist of a <cite>JobManager</cite> and a pool of <cite>Worker</cite> resources where the job executes.)</p>
<p>The 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.</p>
</div>
<div class="section" id="router-addressing">
<h3>ROUTER Addressing<a class="headerlink" href="#router-addressing" title="Permalink to this headline">¶</a></h3>
<p>In 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.</p>
<p>From the 0MQ manual[[2](<a class="reference external" href="http://api.zeromq.org/master:zmq-socket">http://api.zeromq.org/master:zmq-socket</a>)]
> 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.</p>
<p>This extra frame is not shown in the specifications below.</p>
</div>
<div class="section" id="global-frames">
<h3>Global Frames<a class="headerlink" href="#global-frames" title="Permalink to this headline">¶</a></h3>
<p>An <strong>ACK</strong> command consists of a 4-frame multipart message, formatted as follows.</p>
<table border="1" class="docutils">
<colgroup>
<col width="8%" />
<col width="19%" />
<col width="73%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">FRAME</th>
<th class="head">Value</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>0</td>
<td>_EMPTY_</td>
<td>leave empty</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>eMQP/1.0</td>
<td>Protocol version</td>
</tr>
<tr class="row-even"><td>2</td>
<td>ACK</td>
<td>command</td>
</tr>
<tr class="row-odd"><td>3</td>
<td>_MSGID_</td>
<td>A unique id for the msg</td>
</tr>
<tr class="row-even"><td>4</td>
<td>_MSGID_</td>
<td>The message id of the message this ACK is acknowledging</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="emqp-client">
<h3>eMQP / Client<a class="headerlink" href="#emqp-client" title="Permalink to this headline">¶</a></h3>
<p>A <strong>REQUEST</strong> command consists of a 7-frame multipart message, formatted as follows.</p>
<table border="1" class="docutils">
<colgroup>
<col width="10%" />
<col width="22%" />
<col width="68%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">FRAME</th>
<th class="head">Value</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>0</td>
<td>_EMPTY_</td>
<td>leave empty</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>eMQP/1.0</td>
<td>Protocol version</td>
</tr>
<tr class="row-even"><td>2</td>
<td>READY</td>
<td>command</td>
</tr>
<tr class="row-odd"><td>3</td>
<td>_MSGID_</td>
<td>A unique id for the msg</td>
</tr>
<tr class="row-even"><td>4</td>
<td>_QUEUE_NAME_</td>
<td>the name of the queue the worker belongs to</td>
</tr>
<tr class="row-odd"><td>5</td>
<td>_HEADERS_</td>
<td>dictionary of headers. can be an empty set</td>
</tr>
<tr class="row-even"><td>6</td>
<td>_MSG_</td>
<td>The message to send</td>
</tr>
</tbody>
</table>
<p>A <strong>PUBLISH</strong> command consists of a 7-frame multipart messag, formatted as follows.</p>
<table border="1" class="docutils">
<colgroup>
<col width="10%" />
<col width="22%" />
<col width="68%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">FRAME</th>
<th class="head">Value</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>0</td>
<td>_EMPTY_</td>
<td>leave empty</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>eMQP/1.0</td>
<td>Protocol version</td>
</tr>
<tr class="row-even"><td>2</td>
<td>PUBLISH</td>
<td>command</td>
</tr>
<tr class="row-odd"><td>3</td>
<td>_MSGID_</td>
<td>A unique id for the msg</td>
</tr>
<tr class="row-even"><td>4</td>
<td>_TOPIC_NAME_</td>
<td>the name of the queue the worker belongs to</td>
</tr>
<tr class="row-odd"><td>5</td>
<td>_HEADERS_</td>
<td>dictionary of headers. can be an empty set</td>
</tr>
<tr class="row-even"><td>6</td>
<td>_MSG_</td>
<td>The message to send</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="emqp-worker">
<h3>eMQP / Worker<a class="headerlink" href="#emqp-worker" title="Permalink to this headline">¶</a></h3>
<p>An <strong>INFORM</strong> command consists of a 5-frame multipart message, formatted as follows.</p>
<table border="1" class="docutils">
<colgroup>
<col width="9%" />
<col width="20%" />
<col width="71%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">FRAME</th>
<th class="head">Value</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>0</td>
<td>_EMPTY_</td>
<td>leave empty</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>eMQP/1.0</td>
<td>Protocol version</td>
</tr>
<tr class="row-even"><td>2</td>
<td>INFORM</td>
<td>command</td>
</tr>
<tr class="row-odd"><td>3</td>
<td>_MSGID_</td>
<td>A unique id for the msg</td>
</tr>
<tr class="row-even"><td>4</td>
<td>_QUEUE_NAME_</td>
<td>csv seperated names of queue the worker belongs to</td>
</tr>
</tbody>
</table>
<p>A <strong>READY</strong> frame consists of a 4-frame multipart message, formatted as follows.</p>
<table border="1" class="docutils">
<colgroup>
<col width="14%" />
<col width="33%" />
<col width="53%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">FRAME</th>
<th class="head">Value</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>0</td>
<td>_EMPTY_</td>
<td>leave empty</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>eMQP/1.0</td>
<td>Protocol version</td>
</tr>
<tr class="row-even"><td>2</td>
<td>READY</td>
<td>command</td>
</tr>
<tr class="row-odd"><td>3</td>
<td>_MSGID_</td>
<td>A unique id for the msg</td>
</tr>
</tbody>
</table>
<p>A <strong>REPLY</strong> frame consists of a 5-frame multipart message, formatted as follows.</p>
<table border="1" class="docutils">
<colgroup>
<col width="13%" />
<col width="31%" />
<col width="56%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">FRAME</th>
<th class="head">Value</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>0</td>
<td>_EMPTY_</td>
<td>leave empty</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>eMQP/1.0</td>
<td>Protocol version</td>
</tr>
<tr class="row-even"><td>2</td>
<td>REPLY</td>
<td>command</td>
</tr>
<tr class="row-odd"><td>3</td>
<td>_MSGID_</td>
<td>A unique id for the msg</td>
</tr>
<tr class="row-even"><td>4</td>
<td>_MSG_</td>
<td>The reply to respond with</td>
</tr>
</tbody>
</table>
<p>A <strong>HEARTBEAT</strong> frame consists of a</p>
<table border="1" class="docutils">
<colgroup>
<col width="14%" />
<col width="33%" />
<col width="53%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">FRAME</th>
<th class="head">Value</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>0</td>
<td>_EMPTY_</td>
<td>leave empty</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>eMQP/1.0</td>
<td>Protocol version</td>
</tr>
<tr class="row-even"><td>2</td>
<td>HEARTBEAT</td>
<td>command</td>
</tr>
<tr class="row-odd"><td>3</td>
<td>_MSGID_</td>
<td>A unique id for the msg</td>
</tr>
<tr class="row-even"><td>4</td>
<td>_UNIX_TS_</td>
<td>A unix timestamp</td>
</tr>
</tbody>
</table>
<p>A <strong>DISCONNECT</strong> frame consists of</p>
<table border="1" class="docutils">
<colgroup>
<col width="14%" />
<col width="33%" />
<col width="53%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">FRAME</th>
<th class="head">Value</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>0</td>
<td>_EMPTY_</td>
<td>leave empty</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>eMQP/1.0</td>
<td>Protocol version</td>
</tr>
<tr class="row-even"><td>2</td>
<td>DISCONNECT</td>
<td>command</td>
</tr>
<tr class="row-odd"><td>3</td>
<td>_MSGID_</td>
<td>A unique id for the msg</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="heartbeating">
<h3>Heartbeating<a class="headerlink" href="#heartbeating" title="Permalink to this headline">¶</a></h3>
<blockquote>
<div><ul class="simple">
<li>HEARTBEAT commands are valid at any time after an INFORM command</li>
<li>Any command except DISCONNECT act as a heartbeat. Peers SHOULD NOT send HEARTBEAT commands while sending other commands.</li>
<li>Both worker and broker MUST send heartbeats at regular and agreed-upon intervals.</li>
<li>If the worker detects that the broker disconnected it SHOULD restart the conversation.</li>
<li>If the broker detects that a worker has disconnected it should stop sending it a message of any type.</li>
</ul>
</div></blockquote>
</div>
<div class="section" id="request-headers">
<h3>Request Headers<a class="headerlink" href="#request-headers" title="Permalink to this headline">¶</a></h3>
<p>Headers MUST be 0 to many comma seperated values inserted into the header field. If there are no headers requried, send an empty string MUST be sent where headers are required.</p>
<p>Below is a table which defines and describes the headers.</p>
<table border="1" class="docutils">
<colgroup>
<col width="9%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="78%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Header</th>
<th class="head">REQUEST</th>
<th class="head">PUBLISH</th>
<th class="head">Default</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>reply-requested</td>
<td>X</td>
<td> </td>
<td>False</td>
<td>Once the job is finished, send a reply back with information from the job. If there is no information reply with a True value.</td>
</tr>
<tr class="row-odd"><td>retry-count:#</td>
<td>X</td>
<td> </td>
<td>0</td>
<td>Retry a failed job this many times before accepting defeat.</td>
</tr>
<tr class="row-even"><td>guarantee</td>
<td>X</td>
<td> </td>
<td>False</td>
<td>Ensure the job completes by letting someone else worry about a success reply.</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="contributing.html" class="btn btn-neutral" title="Contributing to EventMQ" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2015, eventboard.io.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>
|