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
Is there any support for providing my own serializer/deserializer for job data?
I've got a hacky way of doing it now, wrapping queue.add and serializing there, and then in my worker handler I deserialize, but that doesn't cover job.updateData so now I'll need to add something for that, and if I wanted to support other operations on the queue then I'd have to handle those too, so this definitely doesn't feel like an ideal way of doing things.
EDIT: The bullmq code was pretty easy to read, I took a stab at adding support here. It's only being used for job.data in this PoC but that feels like the safest/minimal thing I'd want. I also haven't tested it yet but was curious to get feedback.
I think usage would be something like:
new Queue<TData>("jobs", { stringify: SuperJSON.stringify, parse: SuperJSON.parse, connection })
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is there any support for providing my own serializer/deserializer for job data?
I've got a hacky way of doing it now, wrapping queue.add and serializing there, and then in my worker handler I deserialize, but that doesn't cover job.updateData so now I'll need to add something for that, and if I wanted to support other operations on the queue then I'd have to handle those too, so this definitely doesn't feel like an ideal way of doing things.
EDIT: The bullmq code was pretty easy to read, I took a stab at adding support here. It's only being used for job.data in this PoC but that feels like the safest/minimal thing I'd want. I also haven't tested it yet but was curious to get feedback.
I think usage would be something like:
And similar for the Worker.
Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions