I’m pretty new to Oban, and have what I think is a fairly simple use case, but had one question about how to handle something during the event of a failure/retry scenario:
I Enqueue a job with a list of IDs to process in an external service. These ID’s basically are just DB record ID’s.
- When the job kicks off, load up the records associated with the ID’s from above.
- Then fire off a request to an external service to basically initiate processing in that service (getting a unique “process ID” back).
- For each of the records I’ve loaded up from the DB, send that record (plus the 'unique process ID") to the external service.
Pretty straightforward?
My question is – if a failure occurs somewhere along the line here (either in the initial request to the external service, or while sending the additional messages to the service, I’d like for the job to retry, BUT:
- I want to track that “unique process ID” i retrieved from the external service
- I want to track the list of records that I’ve already successfully sent to the external service.
I assumed I could just update the Oban.Job record (maybe the args, maybe the metadata?) to hold this extra info – and when the worker’s perform/1 gets called again during the retry, I can just check if that extra info is present.
But the Oban docs don’t seem to cover anything around updating an Oban Job record, so I’m wondering if Job’s are really meant to be insert-only? From a user perspective, at least, there’s Oban.insert/3, but no Oban.update/x sort of function.
If I didn’t need to start off the job by retrieving that “unique process ID” from the external service, I could see just implementing a job-per-record (though it feels a little… extravagent? to break it down that much)
Am I thinking about this wrong?






















