Implement an Oban Worker
In the previous section, you got a sneak peek of what an Oban worker module looks like—it’s really simple to create one. But before we get to that point, we need to set up Oban. Once Oban is set up for our app, we’ll add our worker and test it out.
Add Oban to Our SMS App
Oban has great guides to walk you through implementing it. It’s a fairly quick process, but it might change slightly over time as the library grows and changes. So if you do run into any issues, then make sure to read the Oban Installation Guide.[101]
The first step is to include the Oban dependency in mix.exs:
| {:oban, "~> 2.16"}, |
And then run mix deps.get to bring it into your project.
Oban uses a database to store jobs, so next ...
Get From Ruby to Elixir now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.