workers-rs icon indicating copy to clipboard operation
workers-rs copied to clipboard

Update queue bindings

Open jdon opened this issue 2 years ago • 1 comments

This PR updates the queue bindings to use the latest features and makes a breaking change to the handling of messages.

New queue features added:

  • Ack() and retry() are now available on the individual message
  • Ack_all() is now available on the message batch

Breaking change:

  • message.id , message.timestamp and message.body have been changed to function calls,
    • i.e message.id() and message.timestamp().
    • Internally we now store the MessageSys inside the message. So rather than eagerly converting the ids and timestamp, we now only do it when the function is called.
  • iter() fn on MessageBatch no longer has a lifetime.

Other changes:

  • Allow for sending and receiving of the raw JsValue:
    • Message now has a raw_body function that returns a JsValue.
      • This is also useful for debugging
    • Queue now has a send_raw function that allows sending of JsValue.
  • raw_iter() fn has been added to MessageBatch.

jdon avatar Jun 13 '23 22:06 jdon

@zebp any chance this could be reviewed and merged? It seems like a useful change, and the review feedback has been addressed?

jakubadamw avatar Nov 14 '23 17:11 jakubadamw

@zebp & @kflansburg, I've updated this PR with the latest changes from main, it would be great if we could get this reviewed and merged at some point🙏

jdon avatar Mar 27 '24 00:03 jdon

I had a fresh look at the latest types and realized there had been more changes to queues since this PR was created.

I've made some more changes, so PR should now be up to date with the latest 2024-03-26 changes

jdon avatar Mar 28 '24 21:03 jdon