diff options
Diffstat (limited to '_sources/protocol.txt')
| -rw-r--r-- | _sources/protocol.txt | 118 |
1 files changed, 71 insertions, 47 deletions
diff --git a/_sources/protocol.txt b/_sources/protocol.txt index c341403..44544d6 100644 --- a/_sources/protocol.txt +++ b/_sources/protocol.txt | |||
| @@ -5,12 +5,12 @@ EventMQ Protocol Specification | |||
| 5 | 5 | ||
| 6 | Goals | 6 | Goals |
| 7 | ===== | 7 | ===== |
| 8 | 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 | 8 | 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. |
| 9 | 9 | ||
| 10 | The goals are to: | 10 | The goals are to: |
| 11 | 11 | ||
| 12 | * Specify a protocol to follow when implementing a component to EventMQ. | 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. | 13 | * Allow requests to be routed to workers by an abstracted service name (named queues). |
| 14 | * Detect disconnected peers through heartbeating. | 14 | * Detect disconnected peers through heartbeating. |
| 15 | * Allow for message tracing and debugging. | 15 | * Allow for message tracing and debugging. |
| 16 | 16 | ||
| @@ -60,6 +60,52 @@ FRAME Value Description | |||
| 60 | 4 _MSGID_ The message id of the message this ACK is acknowledging | 60 | 4 _MSGID_ The message id of the message this ACK is acknowledging |
| 61 | ====== ============== =========== | 61 | ====== ============== =========== |
| 62 | 62 | ||
| 63 | A **REPLY** frame consists of a 5-frame multipart message, formatted as follows. | ||
| 64 | |||
| 65 | ====== ============== =========== | ||
| 66 | FRAME Value Description | ||
| 67 | ====== ============== =========== | ||
| 68 | 0 _EMPTY_ leave empty | ||
| 69 | 1 eMQP/1.0 Protocol version | ||
| 70 | 2 REPLY command | ||
| 71 | 3 _MSGID_ A unique id for the msg | ||
| 72 | 4 _MSG_ The reply to respond with | ||
| 73 | ====== ============== =========== | ||
| 74 | |||
| 75 | A **HEARTBEAT** frame consists of a | ||
| 76 | |||
| 77 | ====== ============== =========== | ||
| 78 | FRAME Value Description | ||
| 79 | ====== ============== =========== | ||
| 80 | 0 _EMPTY_ leave empty | ||
| 81 | 1 eMQP/1.0 Protocol version | ||
| 82 | 2 HEARTBEAT command | ||
| 83 | 3 _MSGID_ A unique id for the msg | ||
| 84 | 4 _UNIX_TS_ A unix timestamp | ||
| 85 | ====== ============== =========== | ||
| 86 | |||
| 87 | A **DISCONNECT** frame consists of | ||
| 88 | |||
| 89 | ====== ============== =========== | ||
| 90 | FRAME Value Description | ||
| 91 | ====== ============== =========== | ||
| 92 | 0 _EMPTY_ leave empty | ||
| 93 | 1 eMQP/1.0 Protocol version | ||
| 94 | 2 DISCONNECT command | ||
| 95 | 3 _MSGID_ A unique id for the msg | ||
| 96 | ====== ============== =========== | ||
| 97 | |||
| 98 | A **KBAI** frame consists of | ||
| 99 | |||
| 100 | ====== ============== =========== | ||
| 101 | FRAME Value Description | ||
| 102 | ====== ============== =========== | ||
| 103 | 0 _EMPTY_ leave empty | ||
| 104 | 1 eMQP/1.0 Protocol version | ||
| 105 | 2 KBAI command | ||
| 106 | 3 _MSGID_ A unique id for the msg | ||
| 107 | ====== ============== =========== | ||
| 108 | |||
| 63 | eMQP / Client | 109 | eMQP / Client |
| 64 | ------------- | 110 | ------------- |
| 65 | A **REQUEST** command consists of a 7-frame multipart message, formatted as follows. | 111 | A **REQUEST** command consists of a 7-frame multipart message, formatted as follows. |
| @@ -159,44 +205,9 @@ FRAME Value Description | |||
| 159 | 3 _MSGID_ A unique id for the msg | 205 | 3 _MSGID_ A unique id for the msg |
| 160 | ====== ============== =========== | 206 | ====== ============== =========== |
| 161 | 207 | ||
| 162 | A **REPLY** frame consists of a 5-frame multipart message, formatted as follows. | ||
| 163 | |||
| 164 | ====== ============== =========== | ||
| 165 | FRAME Value Description | ||
| 166 | ====== ============== =========== | ||
| 167 | 0 _EMPTY_ leave empty | ||
| 168 | 1 eMQP/1.0 Protocol version | ||
| 169 | 2 REPLY command | ||
| 170 | 3 _MSGID_ A unique id for the msg | ||
| 171 | 4 _MSG_ The reply to respond with | ||
| 172 | ====== ============== =========== | ||
| 173 | |||
| 174 | A **HEARTBEAT** frame consists of a | ||
| 175 | |||
| 176 | ====== ============== =========== | ||
| 177 | FRAME Value Description | ||
| 178 | ====== ============== =========== | ||
| 179 | 0 _EMPTY_ leave empty | ||
| 180 | 1 eMQP/1.0 Protocol version | ||
| 181 | 2 HEARTBEAT command | ||
| 182 | 3 _MSGID_ A unique id for the msg | ||
| 183 | 4 _UNIX_TS_ A unix timestamp | ||
| 184 | ====== ============== =========== | ||
| 185 | |||
| 186 | A **DISCONNECT** frame consists of | ||
| 187 | |||
| 188 | ====== ============== =========== | ||
| 189 | FRAME Value Description | ||
| 190 | ====== ============== =========== | ||
| 191 | 0 _EMPTY_ leave empty | ||
| 192 | 1 eMQP/1.0 Protocol version | ||
| 193 | 2 DISCONNECT command | ||
| 194 | 3 _MSGID_ A unique id for the msg | ||
| 195 | ====== ============== =========== | ||
| 196 | |||
| 197 | Heartbeating | 208 | Heartbeating |
| 198 | ------------ | 209 | ------------ |
| 199 | * HEARTBEAT commands are valid at any time after an INFORM command | 210 | * HEARTBEAT commands are valid at any time after an INFORM command. |
| 200 | * Any command except DISCONNECT act as a heartbeat. Peers SHOULD NOT send HEARTBEAT commands while sending other commands. | 211 | * Any command except DISCONNECT act as a heartbeat. Peers SHOULD NOT send HEARTBEAT commands while sending other commands. |
| 201 | * Worker and broker MUST send heartbeats at regular and agreed-upon intervals. | 212 | * Worker and broker MUST send heartbeats at regular and agreed-upon intervals. |
| 202 | * Scheduler and broker MUST send heartbeats at regular and agreed-upon intervals. | 213 | * Scheduler and broker MUST send heartbeats at regular and agreed-upon intervals. |
| @@ -204,16 +215,29 @@ Heartbeating | |||
| 204 | * If the broker detects that a worker has disconnected it should stop sending it a message of any type. | 215 | * If the broker detects that a worker has disconnected it should stop sending it a message of any type. |
| 205 | * If the scheduler detects that the broker disconnects it SHOULD restart the conversation. | 216 | * If the scheduler detects that the broker disconnects it SHOULD restart the conversation. |
| 206 | 217 | ||
| 207 | REQUEST Headers | 218 | Headers |
| 208 | --------------- | 219 | --------------- |
| 209 | Headers MUST be 0 to many comma seperated values inserted into the header field. If there are no headers required, send an empty string MUST be sent where headers are required. | 220 | Headers 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. |
| 210 | 221 | ||
| 211 | Below is a table which defines and describes the headers. | 222 | Below is a table which defines and describes the headers. |
| 212 | 223 | ||
| 213 | =============== ======= ======= ======= =========== | 224 | |
| 214 | Header REQUEST PUBLISH Default Description | 225 | ================= ======= ======= ======== ======= =========== |
| 215 | =============== ======= ======= ======= =========== | 226 | Header REQUEST PUBLISH SCHEDULE Default Description |
| 216 | reply-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. | 227 | ================= ======= ======= ======== ======= =========== |
| 217 | retry-count:# X 0 Retry a failed job this many times before accepting defeat. | 228 | reply-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. |
| 218 | guarantee X False Ensure the job completes by letting someone else worry about a success reply. | 229 | retry-count:# X 0 Retry a failed job this many times before accepting defeat. |
| 219 | =============== ======= ======= ======= =========== | 230 | guarantee X False Ensure the job completes by letting someone else worry about a success reply. |
| 231 | nohaste 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. | ||
| 232 | ================= ======= ======= ======== ======= =========== | ||
| 233 | |||
| 234 | DISCONNECT and KBAI | ||
| 235 | =================== | ||
| 236 | When a component receives a DISCONNECT command it: | ||
| 237 | * MUST send a KBAI command to all connected components. | ||
| 238 | * MUST stop sending and receiving any messages | ||
| 239 | * MUST allow any pending messages or jobs to complete. | ||
| 240 | |||
| 241 | When a component receives a KBAI command it: | ||
| 242 | * MUST stop sending any messages to the disconnecting component. | ||
| 243 | * SHOULD Clean up references to the disconnecting component. | ||