Verk.Events.JobFinished/JobFailed; is it possible to "know" the args values with which the Job finished/failed when we receive the Verk.Events?
florinpatrascu opened this issue · comments
Hi there,
I am new here and I want to start by thanking you for this awesome project!
For our project, we would need to monitor the events around jobs, so that we can send an ... ACK, for example, to an external service when the jobs are done (finished) or another message when/if they are failing. So that the ACK, in my previous example, will contain an ID that was initially given to the Job, as a job arg.
And to do that, I am thinking I could subscribe to the Verk.EventProducer
for the JobFailed
and JobFinished
events, an implementation similar to the example you describe in the main README, for the error tracking, respectively.
My question is, would I have access to the job's args, when I receive the %Verk.Events.JobFinished/JobFailed
event? So that I retrieve my "ACK" id, to follow the example scenario above.
If not, is there a way to get access to the job 's args on failure/finished/etc events?
Thank you!
@florinpatrascu yes the job
is always accessible. more info about the events structs here:
https://github.com/edgurgel/verk/blob/master/lib/verk/events.ex
The example from the error tracking section of the README has this line using the job
:
defp handle_event(%Verk.Events.JobFailed{job: job, failed_at: failed_at, stacktrace: trace}) do
MyTrackingExceptionSystem.track(stacktrace: trace, name: job.class)
end
And the job has the whole information of the class/module
, args
, enqueued_at
, etc