In a series of four IronCasts, we will provide a high-level introduction to using IronWorker. IronWorker is an easy-to-use scalable task queue that gives cloud developers a simple way to offload front-end tasks, run scheduled jobs, and process tasks in the background and at scale.
These videocasts will cover core concepts including:
- Deploying a worker
- Writing worker files to declare dependencies
- Test and prototype workers rapidly locally
- Connecting to a cloud development database
We will be using an example application which is written in Rails. However, the same concept applies to every language or framework. IronWorker can handle almost every language including binary files and so if you program in PHP,Python, Node.js, or other languages, don't worry, we have client libraries and examples to show you the way. It should also be possible to convert this example to the language of your choice without much effort. Please refer to further documentation here.
In this video, we will show you how to upload and run a worker in the IronWorker environment. We will deploy a worker that makes external API calls in the background in four simple steps:
Step 1: Worker controller code
This code appears within your application logic and queues up the worker task to run in IronWorker.
Step 2: Worker code
This worker will get uploaded to IronWorker and will run in the background asynchronously when invoked. This worker makes an external API request and then saves the results into the database.
Step 3: Worker file (.worker)
This file declares your IronWorker’s dependencies so that we can package up the dependencies and make them available to your worker.
Step 4: Uploading to IronWorker
After you install the IronWorker CLI. The CLI instruction, iron_worker upload [WORKER NAME] looks for an iron.json where you Iron.io credentials should be stored. Therefore, if you stored your iron.json in your workers folder, you should first cd into that folder. [WORKER NAME] is the file name of the .worker file.
cd workers iron_worker upload pygments
And that’s it! Four simple steps and you have deployed your first IronWorker. Once the worker has been uploaded, you can queue up tasks from the application or you can queue up tasks from the CLI. In the following three episodes of IronCast, we will dive into the details how to construct your own worker file, how to prototype with IronWorker locally and how to have your workers connect to your cloud hosted database.
But for now, you should have enough to get up and running on IronWorker. Sign up for a free account and run this example. Or you can check out other examples on Github as well as dive into more details on the service within our Dev Center.