Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Document request options
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Mar 21, 2017
1 parent f40d374 commit f2ec86c
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The following documents are core to tchannel

- [channel](./channel/)
- [sub-channels](./sub-channels/)
- [requests](./requests/)
- [hyperbahn](./hyperbahn/)
- [as-thrift](./as-thrift/)

Expand Down
93 changes: 93 additions & 0 deletions docs/requests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

# TChannel requests

You can create and send TChannel requests with TChannel or a sub-channel using
`request` followed by `send`.

```js
channel
.request(requestOptions)
.send(procedure, headers, body, callback);
```

The following documents request options.

### `options.parent` or `options.hasNoParent`

The parent request contributes to tracing and clamping the TTL for the outbound
request (less time spent in process since the parent request was received).
You must provide either the parent request or explicitly state that there is no
parent request.

### `options.serviceName` (empty)

Indicates the callee service name.


### `options.shouldApplicationRetry` (`null`)

If provided, specifies a function that determines whether TChannel should retry
application errors (as opposed to TChannel transport errors).
Transport errors indicate that the request and response were not completely
sent or received.
Application errors indicate that the request and response were successfully
transported, but the body of the response indicates an application exception.
TChannel does not retry application errors by default.
This function if provided allows TChannel to distinguish retryable requests.
The function receives the exception info and the decoded request and response
body.

### `options.timeout` (none)

Specifies the total time a request can spend in-process before timing out.
The deadline/ttl are communicated on the wire to downstream services so they
can shed work for requests that have or are very likely to time out.

### `options.timeoutPerAttempt` (none)

TChannel may retry requests until the timeout.
Each attempt may have a more constrainted timeout, after which it will make
another attempt.

### `options.retryLimit`

Determines the maximum number of attempts TChannel may make to fulfill the
request.

### `options.retryFlags`

The retry flags is an optional object with three boolean properties:

- `never` indicates that the request should not be retried under any
circumstance.
- `onConnectionError` indicates that the request should be retried if TChannel
fails to deliver the request due to a connection error.
- `onTimeout` indicates that the request should be retried of the request times
out.

### `options.streamed` (`false`)

Indicates that the request and response should be streamed, so all arguments
will be modeled with streams instead of buffers.
Streamed requests will time out only if they fail to receive the *first* frame of
the response before the deadline elapses.
Non-streamed requests time out if they fail to receive the *last* frame of the
response before the deadline elapses.

### `options.trackPending`

If specified as false, indicates that the request should not count toward the
pending requests for a peer for purposes of load balancing.

### Other

Not yet documented:

- `options.host` (`''`)
- `options.checksumType`
- `options.forwardTrace`
- `options.trace`
- `options.tracing`
- `options.checksum`
- `options.peer`
- `options.headers`

0 comments on commit f2ec86c

Please sign in to comment.