Using workers

A worker is a class or struct that performs tasks for us; it is usually a bit more complicated than what a controller would do. Examples of this include converting images, processing orders, and working through batches. In traditional server setups, you would do the same through cron jobs.

Depending on the nature of what your workers will do, you could wrap their functionality into a job with the vapor/jobs package. That way, you have automatic retries already given. You can check out the package here: https://github.com/vapor/jobs

And that's it  our template is ready! You can find the full working template in the GitHub repository for this chapter!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.66.31