You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: integrating.md
+18-4Lines changed: 18 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -243,16 +243,30 @@ Ensure `mongocrypt_setopt_retry_kms` is called on the `mongocrypt_t` to enable r
243
243
c. Write the message from `mongocrypt_kms_ctx_message` to the
244
244
> socket.
245
245
246
-
d. Feed the reply back with `mongocrypt_kms_ctx_feed`. Repeat
247
-
> until `mongocrypt_kms_ctx_bytes_needed` returns 0.
246
+
d. Feed the reply back with `mongocrypt_kms_ctx_feed` or `mongocrypt_kms_ctx_feed_with_retry`. Repeat
247
+
until `mongocrypt_kms_ctx_bytes_needed` returns 0. If the `should_retry` outparam returns true,
248
+
the request may be retried by feeding the new response into the same context.
248
249
249
250
If any step encounters a network error, call `mongocrypt_kms_ctx_fail`.
250
-
If `mongocrypt_kms_ctx_fail` returns true, continue to the next KMS context.
251
+
If `mongocrypt_kms_ctx_fail` returns true, retry the request by continuing to the next KMS context or by feeding the new response into the same context.
251
252
If `mongocrypt_kms_ctx_fail` returns false, abort and report an error. Consider wrapping the error reported in `mongocrypt_kms_ctx_status` to include the last network error.
252
253
253
254
2. When done feeding all replies, call `mongocrypt_ctx_kms_done`.
254
255
255
-
Note, the driver MAY fan out KMS requests in parallel. More KMS requests may be added when processing responses to retry.
256
+
##### Retry and Iteration
257
+
258
+
Call `mongocrypt_setopt_retry_kms` to enable retry behavior.
259
+
260
+
There are two options for retry:
261
+
- Lazy retry: After processing KMS contexts, iterate again by calling `mongocrypt_ctx_next_kms_ctx`. KMS contexts
262
+
needing a retry will be returned.
263
+
- In-place retry: If a KMS context indicates retry, retry the KMS request and feed the new response to the same KMS
264
+
context. Use `mongocrypt_kms_ctx_feed_with_retry` and check the return of `mongocrypt_kms_ctx_fail` to check if a
265
+
retry is indicated.
266
+
267
+
The driver MAY fan out KMS requests in parallel. It is not safe to iterate KMS contexts (i.e. call
268
+
`mongocrypt_ctx_next_kms_ctx`) while operating on KMS contexts (e.g. calling `mongocrypt_kms_ctx_feed`). Drivers are
269
+
recommended to do an in-place retry on KMS requests.
0 commit comments