workers-rs
workers-rs copied to clipboard
Update queue bindings
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()andretry()are now available on the individual messageAck_all()is now available on the message batch
Breaking change:
message.id,message.timestampandmessage.bodyhave been changed to function calls,- i.e
message.id()andmessage.timestamp(). - Internally we now store the
MessageSysinside themessage. So rather than eagerly converting the ids and timestamp, we now only do it when the function is called.
- i.e
iter()fn onMessageBatchno longer has a lifetime.
Other changes:
- Allow for sending and receiving of the raw
JsValue:Messagenow has araw_bodyfunction that returns aJsValue.- This is also useful for debugging
Queuenow has asend_rawfunction that allows sending ofJsValue.
raw_iter()fn has been added toMessageBatch.
@zebp any chance this could be reviewed and merged? It seems like a useful change, and the review feedback has been addressed?
@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🙏
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