docmq icon indicating copy to clipboard operation
docmq copied to clipboard

feat: Refactor payload encoding/decoding for extensibility

Open PonomareVlad opened this issue 6 months ago • 3 comments

new Queue(driver, name, {
    decodePayload: payload => payload,
    encodePayload: payload => payload,
})
Demo (before/after)

Снимок экрана 2025-05-22 в 23 06 29

PonomareVlad avatar May 22 '25 18:05 PonomareVlad

I'm all for this change. Do you mind adding a little bit of context for the bug or use case this PR addresses? It'll help other people if they had this issue also find the fix and what version they'll be needing.

Thank you for your feedback, I just want to offer a way to conveniently data serialization, which can be useful for MongoDB users (the ability to find a job by its payload)

new Queue(driver, name, {
    decodePayload: payload => payload,
    encodePayload: payload => payload,
})
Demo (before/after)

Снимок экрана 2025-05-22 в 23 06 29

PonomareVlad avatar May 22 '25 21:05 PonomareVlad

Or maybe...

  • #19

PonomareVlad avatar May 22 '25 23:05 PonomareVlad

I think the approach you have here w/ instance based encode/decode is the correct way to do this. The tests are failing, but that is likely a "me" problem, because we haven't had to update the tooling and cut a release in a while.

thecodedrift avatar Jun 04 '25 17:06 thecodedrift