|
2 | 2 |
|
3 | 3 | ## Overview |
4 | 4 |
|
5 | | -The Nexus protocol, as specified below, is a synchronous RPC protocol. Arbitrary duration operations are modelled on top |
6 | | -of a set of pre-defined synchronous RPCs. |
| 5 | +The Nexus protocol, as specified below, is a synchronous RPC protocol for system-to-system integration. Arbitrary |
| 6 | +duration operations are modelled on top of a set of pre-defined synchronous RPCs. |
7 | 7 |
|
8 | 8 | A Nexus **caller** calls a **handler**. The handler may respond inline (synchronous response) or return a token |
9 | | -referencing the ongoing operation (asynchronous response). The caller can cancel an asynchronous operation, check for |
10 | | -its outcome, or fetch its current state. The caller can also specify a callback URL, which the handler uses to deliver |
11 | | -the result of an asynchronous operation when it is ready. |
| 9 | +referencing the ongoing operation (asynchronous response), which the the caller use to cancel the operation. In lieu of |
| 10 | +a higher level service contract, the caller cannot determine whether an operation is going to resolve synchronously or |
| 11 | +asynchronously, and should specify a callback URL, which the handler uses to deliver the result of an asynchronous |
| 12 | +operation when it is ready. |
12 | 13 |
|
13 | 14 | ## Operation Addressability |
14 | 15 |
|
@@ -185,109 +186,6 @@ The operation token received as a response to the Start Operation method must be |
185 | 186 |
|
186 | 187 | **Body**: A JSON serialized [`Failure`](#failure) object. |
187 | 188 |
|
188 | | -### Fetch Operation Result |
189 | | - |
190 | | -Retrieve operation result. |
191 | | - |
192 | | -**Path**: `/{service}/{operation}/result` |
193 | | - |
194 | | -**Method**: `GET` |
195 | | - |
196 | | -#### Request Headers |
197 | | - |
198 | | -The operation token received as a response to the Start Operation method must be delivered either via the |
199 | | -`Nexus-Operation-Token` header field or the `token` query param. |
200 | | - |
201 | | -#### Query Parameters |
202 | | - |
203 | | -- `token`: The operation token received as a response to the Start Operation method. Must be delivered either via the |
204 | | - `token` query param or the `Nexus-Operation-Token` header field. |
205 | | - |
206 | | -- `wait`: Optional. Duration indicating the waiting period for a result, defaulting to no wait. If by the end of the |
207 | | - wait period the operation is still running, the request should resolve with a `412` status code (see below). |
208 | | - |
209 | | - Format of this parameter is number + unit, where unit can be `ms` for milliseconds, `s` for seconds, and `m` for |
210 | | - minutes. Examples: |
211 | | - |
212 | | - - `100ms` |
213 | | - - `1m` |
214 | | - - `5s` |
215 | | - |
216 | | -#### Response Codes |
217 | | - |
218 | | -- `200 OK`: Operation completed successfully. |
219 | | - |
220 | | - **Headers**: |
221 | | - |
222 | | - - `Nexus-Operation-State: succeeded` |
223 | | - |
224 | | - **Body**: Arbitrary data conveying the operation's result. Headers should specify content type and encoding. |
225 | | - |
226 | | -- `408 Request Timeout`: The handler gave up waiting for operation completion. The request may be retried by the caller. |
227 | | - |
228 | | - **Body**: Empty. |
229 | | - |
230 | | -- `412 Precondition Failed`: Operation still running. |
231 | | - |
232 | | - When waiting for completion, the caller may re-issue this request to start a new long poll. |
233 | | - |
234 | | - **Body**: Empty. |
235 | | - |
236 | | -- `424 Failed Dependency`: Operation completed as `failed` or `canceled`. |
237 | | - |
238 | | - **Headers**: |
239 | | - |
240 | | - - `Content-Type: application/json` |
241 | | - - `Nexus-Operation-State: failed | canceled` |
242 | | - |
243 | | - **Body**: A JSON-serialized [`Failure`](#failure) object. |
244 | | - |
245 | | -- `404 Not Found`: Operation token not recognized or references deleted. |
246 | | - |
247 | | - **Headers**: |
248 | | - |
249 | | - - `Content-Type: application/json` |
250 | | - |
251 | | - **Body**: A JSON-serialized [`Failure`](#failure) object. |
252 | | - |
253 | | -### Fetch Operation Info |
254 | | - |
255 | | -Retrieve operation details. |
256 | | - |
257 | | -**Path**: `/{service}/{operation}` |
258 | | - |
259 | | -**Method**: `GET` |
260 | | - |
261 | | -#### Request Headers |
262 | | - |
263 | | -The operation token received as a response to the Start Operation method must be delivered either via the |
264 | | -`Nexus-Operation-Token` header field or the `token` query param. |
265 | | - |
266 | | -#### Query Parameters |
267 | | - |
268 | | -- `token`: The operation token received as a response to the Start Operation method. Must be delivered either via the |
269 | | - `token` query param or the `Nexus-Operation-Token` header field. |
270 | | - |
271 | | -#### Response Codes |
272 | | - |
273 | | -- `200 OK`: Successfully retrieved info. |
274 | | - |
275 | | - **Headers**: |
276 | | - |
277 | | - - `Content-Type: application/json` |
278 | | - |
279 | | - **Body**: |
280 | | - |
281 | | - A JSON-serialized [`OperationInfo`](#operationinfo) object. |
282 | | - |
283 | | -- `404 Not Found`: Operation token not recognized or references deleted. |
284 | | - |
285 | | - **Headers**: |
286 | | - |
287 | | - - `Content-Type: application/json` |
288 | | - |
289 | | - **Body**: A JSON-serialized [`Failure`](#failure) object. |
290 | | - |
291 | 189 | ## Predefined Handler Errors |
292 | 190 |
|
293 | 191 | For compatiblity of this HTTP spec with future transports, when a handler fails a request, it **should** use one of the |
|
0 commit comments