MQ-1200 Add response body to queue send() and sendBatch()#6354
Conversation
| jsg::JsValue body, | ||
| jsg::Optional<SendOptions> options, | ||
| const jsg::TypeHandler<SendResponse>& responseHandler); | ||
|
|
There was a problem hiding this comment.
I forget, did we decide to put send() / sendBatch() with responses behind a compat flag? To me this change looks non-breaking, and so does not necessarily need to be behind a compat flag. It'd certainly make implementation a lot simpler too?
There was a problem hiding this comment.
Leaving this here for posterity:
Based on discussions, we decided to compat flag these changes. After internal testing, we'll need to put in a PR to default on flags and also regenerate the production type files. We were imagining all the metrics changes can go in together, so this may be the easier approach for us.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6354 +/- ##
==========================================
- Coverage 70.80% 70.67% -0.14%
==========================================
Files 422 420 -2
Lines 112347 113176 +829
Branches 18411 18561 +150
==========================================
+ Hits 79547 79986 +439
- Misses 21806 22128 +322
- Partials 10994 11062 +68 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7bc3b24 to
a88a242
Compare
a88a242 to
e7cc945
Compare
Summary
Adds support for returning structured JSON responses from the
send()andsendBatch()methods from a worker'senv.QUEUEbinding. The changes are gated behind thequeue_send_response_body/no_queue_send_response_bodyflag.Changes
Depending on the experimental
queue_send_response_bodyflag, eitherPromise<void>orPromise<QueueSendResponse>will be returned by the send methods. In order to support both the old and new return types, the functions had to be duplicated.On the Typescript side, these new functions are exposed with the same name.
Upstream changes can be found here: https://gitlab.cfdata.org/cloudflare/mq/queue-broker-worker/-/merge_requests/1768#c210bdd061230e9c1f9da3b517fbecabd025c5c4
Testing
bazel test //src/workerd/api/tests:queue-test@bazel test //src/workerd/api/tests:queue-test@all-compat-flagsbazel test //src/workerd/api/tests:queue-producer-metadata-test@bazel test //src/workerd/api/tests:queue-producer-metadata-test@all-compat-flags