Skip to content

Support a discarded callback #27

@andykent

Description

@andykent

I have a requirement to take some action when a job reaches it's max attempts and is discarded from the queue. I was hoping it would be possible to add a callback to Oban.Worker to handle this. I imagine something like this...

defmodule MyWorker do
  use Oban.Worker, max_attempts: 5

  def discarded(job) do
    Logger.info("job #{job.id} was discarded after #{job.attempts}")
  end
end

note: my use case is more complex than simple logging but hopefully it illustrates the point.

If this is something you would be willing to support in Oban I can have a go at putting together a PR to add the functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions