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
I need to "broadcast" an event on job completion/failure, and I need to access an attribute associated with the job in the listeners.
I am planning to use QueueEvents for this, because as I understand, they are received by all the listeners, not just a single one (like a job).
My problem is, that the QueueEventsListener methods only receive the jobId.
So as I see my current options are:
Encode my custom job attribute into the return value at completion and into the failedReason at failure.
Encode the attribute into the jobId (encompanied by a random value, because the attribute is not unique).
Get the full job from the queue in the listeners. This could be a good option, but in this case I cannot use the 'removeOnCompletion' option, because the job would't exist anymore in the completion listener.
Store the jobId -> myattriibute map somewhere separately from bullMQ.
Use job.updateProgress({ myattribute, event: 'complete/failed' }) before completion & failure, and listen for this instead.
As I see, all of them can work, but none of them are really nice.
The feature I would prefer is:
access the job data in the QueueEventsListener or
access the job name in the QueueEventsListener
Or is there some other option I am overlooking?
Thank you!
The text was updated successfully, but these errors were encountered:
We try to send as little data as possible in the events as this has an impact on performance.
If with broadcast you mean that the event should be sent to many receivers, you could try to use the updateProgress method inside the job processor, and send arbitrary data in it that your listeners could receive listening to the "progress" event in the Queue: https://api.docs.bullmq.io/interfaces/QueueListener.html#progress
Hello,
I need to "broadcast" an event on job completion/failure, and I need to access an attribute associated with the job in the listeners.
I am planning to use QueueEvents for this, because as I understand, they are received by all the listeners, not just a single one (like a job).
My problem is, that the QueueEventsListener methods only receive the jobId.
So as I see my current options are:
As I see, all of them can work, but none of them are really nice.
The feature I would prefer is:
Or is there some other option I am overlooking?
Thank you!
The text was updated successfully, but these errors were encountered: