Class: ActionMailer::MailDeliveryJob
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
|
Instance Chain:
self,
::ActiveJob::Base,
::ActiveJob::Translation,
::ActiveJob::Timezones,
::ActiveJob::Logging,
::ActiveJob::Instrumentation,
::ActiveJob::Exceptions,
::ActiveJob::Callbacks,
::ActiveSupport::Callbacks,
::ActiveJob::Execution,
::ActiveSupport::Rescuable,
::ActiveJob::Enqueuing,
::ActiveJob::QueuePriority,
::ActiveJob::QueueName,
::ActiveJob::QueueAdapter,
::ActiveJob::Core
|
|
| Inherits: |
ActiveJob::Base
|
| Defined in: | actionmailer/lib/action_mailer/mail_delivery_job.rb |
Overview
The MailDeliveryJob class is used when you want to send emails outside of the request-response cycle. It supports sending either parameterized or normal mail.
Exceptions are rescued and handled by the mailer class.
Constant Summary
::ActiveSupport::Callbacks - Included
::ActiveJob::Exceptions - Included
Class Attribute Summary
::ActiveJob::Base - Inherited
| ._queue_adapter, ._queue_adapter_name, .after_discard_procs, .after_discard_procs?, .enqueue_after_transaction_commit, .log_arguments, .log_arguments?, | |
| .logger | Accepts a logger conforming to the interface of Log4r or the default Ruby |
| .priority, .priority?, .queue_name, .queue_name?, .queue_name_delimiter, .queue_name_delimiter?, .queue_name_prefix, .queue_name_prefix?, .retry_jitter | |
Class Method Summary
::ActiveSupport::DescendantsTracker - Inherited
Instance Attribute Summary
::ActiveJob::Base - Inherited
| #after_discard_procs, #after_discard_procs?, #logger, #queue_adapter, #queue_name_prefix, #queue_name_prefix? |
::ActiveJob::Logging - Included
::ActiveJob::Callbacks - Included
::ActiveJob::Execution - Included
::ActiveJob::Core - Included
| #arguments | Job arguments. |
| #enqueue_error | Track any exceptions raised by the backend so callers can inspect the errors. |
| #enqueued_at | Track when a job was enqueued. |
| #exception_executions |
|
| #executions | Number of times this job has been executed (which increments on every retry, like after an exception). |
| #job_id | Job Identifier. |
| #locale |
|
| #priority= | Priority that the job will have (lower is more priority). |
| #provider_job_id | ID optionally provided by adapter. |
| #queue_name= | Queue in which the job will reside. |
| #scheduled_at |
|
| #serialized_arguments=, #successfully_enqueued?, | |
| #timezone | Timezone to be used during the job. |
| #arguments_serialized?, | |
| #successfully_enqueued= | Track whether the adapter received the job successfully. |
Instance Method Summary
- #perform(mailer, mail_method, delivery_method, args:, kwargs: nil, params: nil)
- #handle_exception_with_mailer_class(exception) private
-
#mailer_class
private
“Deserialize” the mailer class name by hand in case another argument (like a Global ID reference) raised DeserializationError.
::ActiveJob::Logging - Included
::ActiveJob::Instrumentation - Included
::ActiveJob::Exceptions - Included
| #retry_job | Reschedules the job to be re-executed. |
| #determine_delay, #determine_jitter_for_delay, #executions_for, #run_after_discard_procs | |
::ActiveSupport::Callbacks - Included
| #run_callbacks | Runs the callbacks for the given event. |
| #halted_callback_hook | A hook invoked every time a before callback is halted. |
::ActiveJob::Execution - Included
| #perform, | |
| #perform_now | Performs the job immediately. |
| #_perform_job | |
::ActiveSupport::Rescuable - Included
| #rescue_with_handler | Delegates to the class method, but uses the instance as the subject for rescue_from handlers (method calls, |
| #handler_for_rescue | Internal handler lookup. |
::ActiveJob::Enqueuing - Included
| #enqueue | Enqueues the job to be performed by the queue adapter. |
| #raw_enqueue | |
::ActiveJob::QueuePriority - Included
| #priority | Returns the priority that the job will be created with. |
::ActiveJob::QueueName - Included
| #queue_name | Returns the name of the queue the job will be run on. |
::ActiveJob::Core - Included
| #deserialize | Attaches the stored job data to the current instance. |
| #initialize | Creates a new job instance. |
| #serialize | Returns a hash with the job data that can safely be passed to the queuing adapter. |
| #deserialize_arguments, #deserialize_arguments_if_needed, #deserialize_time, #serialize_arguments, #serialize_arguments_if_needed, | |
| #set | Configures the job with the given options. |
Instance Method Details
#handle_exception_with_mailer_class(exception) (private)
[ GitHub ]# File 'actionmailer/lib/action_mailer/mail_delivery_job.rb', line 40
def handle_exception_with_mailer_class(exception) if klass = mailer_class klass.handle_exception exception else raise exception end end
#mailer_class (private)
“Deserialize” the mailer class name by hand in case another argument (like a Global ID reference) raised DeserializationError.
#perform(mailer, mail_method, delivery_method, args:, kwargs: nil, params: nil)
[ GitHub ]# File 'actionmailer/lib/action_mailer/mail_delivery_job.rb', line 21
def perform(mailer, mail_method, delivery_method, args:, kwargs: nil, params: nil) mailer_class = params ? mailer.constantize.with(params) : mailer.constantize = if kwargs mailer_class.public_send(mail_method, *args, **kwargs) else mailer_class.public_send(mail_method, *args) end .send(delivery_method) end