提交 5c13e8c9 编写于 作者: G Gerard Cahill

add section to guides for discarding and retrying active jobs [ci skip]

上级 00cc168f
......@@ -389,6 +389,25 @@ class GuestsCleanupJob < ApplicationJob
end
```
### Retrying or Discarding failed jobs
It's also possible to retry or discard a job if an exception is raised during execution.
For example:
```ruby
class RemoteServiceJob < ActiveJob::Base
retry_on CustomAppException # defaults to 3s wait, 5 attempts
discard_on ActiveJob::DeserializationError
def perform(*args)
# Might raise CustomAppException or ActiveJob::DeserializationError
end
end
```
To get more details see the API Documentation for [ActiveJob::Exceptions](http://api.rubyonrails.org/classes/ActiveJob/Exceptions/ClassMethods.html).
### Deserialization
GlobalID allows serializing full Active Record objects passed to `#perform`.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册