Closed p3drosola closed 1 month ago
Hey @p3drosola! 👋🏻
What's your use case for accessing the job instance? I would rather create a proper getter for your use case than give direct access to the BullMQ Job instance. Why? Because I may want to create a proper abstraction in the future so we can have a "real" queue package, and being deeply linked to BullMQ will not help. 😄
Hi, Ok. That's why I can not access to the job in my handle function. You're doing a pretty good job and of course, I understand the reason why. Even I can't wait for a "good solution", I can also describe my use case. My use case could be : My job can be a "waiting job" to access to an asynchronous data (slow integration of a file in a document manager). I decided to init the job with 5 attempts and a waiting delay of 5000ms :
In my case in particular I need:
I understand the desire to provide a generic job queue wrapper, but for now It'd be preferable not cripple the bullmq functionality, and allow us to access the bullmq job object directly since this abstraction:
a) does not support other job queues b) does not even attempt to provide the full bullmq api surface area
You are right. Better off leveraging BullMQ than trying to create a bad abstraction for now.
It will be available using this.getJob()
inside the handle
or rescue
method.
Hi @RomainLanz ,
I'm taking another stab at upgrading my app. I saw you added the getJob method but the latest version on NPM doesn't include it. Any chance you could publish a new version?
Thanks in advance!
Done! 👍🏻
In the v2 version of this library for adonis v5, to access the bullmq job you could access
this.job
in the handler function.I've checked the source and can see the
#bullMqJob
private variable, but it's not accesible by the classes that inherit from Job.Would you accept a pr for a
getJob
function, or a making the variable public?