Elixir worker for Faktory (blog) (github).
faktory_worker_ex is available on hex.pm.
All configuration is optional with sane defaults and will connect to a
Faktory server on localhost:7419
.
See the hexdocs for more on configuration.
Very similar to Sidekiq...
defmodule FunWork do
use Faktory.Job
faktory_options queue: "default", retry: 25, backtrace: 0
def perform(x, y) do
IO.puts "#{x} is a fun number! ... #{y} is not... :("
end
end
faktory_options
are optional and default to the above.
Now fire up iex...
iex(1)> FunWork.perform_async([5, 6])
Notice that you have to pass a list to perform_async/1
... that's just because
of how Kernel.apply/3
works. No (un)splatting in Elixir... :/
mix faktory
You should see logging output and the above job being processed.
To run this readme's example, you need to run a Faktory server.
Easiest way is with Docker:
docker run --rm -p 7419:7419 -p 7420:7420 contribsys/faktory:latest -b :7419
You should be able to go to http://localhost:7420 and see the web ui.
- Middleware
- Connection pooling
- Support for multiple Faktory servers
- Faktory server authentication and TLS support
- Comprehensive documentation
- Comprehensive supervision tree
- Decent integration tests
- Responding to the terminate signal from the Faktory server
Hit me up on Github Issues.