Is it ok to have a `SendEmail` rack middleware or other such background job middlewares?

179 Views Asked by At

I read rack middleware is for modifying the current request/response, but what about having a SendEmail middlewares which would look at env['user_id'] to send emails.

Let's assume the entire process (request + sending emails) will be async.

1

There are 1 best solutions below

0
On BEST ANSWER

If you really want to do it in Goliath I'd suggest creating a plugin and doing it in there. Create a queue in the config and have the plugin pop items from the queue and send the mail.