009 Activejob.Mp4

about 2 months ago

First 1024 characters of the closed caption:


Alright, today we are going to be continuing from episode 8. If you remember from episode 8, we had our contact form which will now send an email whenever we send the message to our support at driftingruby.com. The problem is, if we had our setup configured to send the email through SMTP, we would notice that the client would have a 1 or 2 second delay while it was connecting to the SMTP server and sending that message. Wouldn't it be nicer if we could just hit send message and the user will immediately get a response back. Now to do something like that, we can push the actual sending of the email into a background process using ActiveJob. ActiveJob is a wrapper for your background processor whether it's Sidekick, DelayedJob, or something similar. Today we are going to look at setting up ActiveJob with DelayedJob. Alright, the first step is to create your job. In our case, we are going to create the contact mailer. You will notice it crea...