Skip to content
Mike Perham edited this page Nov 13, 2017 · 12 revisions

faktory_worker_ruby (aka FWR) is a similar package to Sidekiq: it provides a multi-threaded process which executes background jobs.

Configuration

Faktory Location

You can point FWR to a custom Faktory location via the FAKTORY_URL environment variable. There is no way to customize the location via Ruby. Here's an example URL for a Faktory server that requires both TLS and password authentication.

FAKTORY_URL=tcp+tls://:[email protected]:7744 bundle exec faktory-worker

Middleware

FWR has a similar notion of middleware to Sidekiq: "client" middleware runs around a "push" to Faktory. "worker" middleware runs around the execution of a job in FWR.

# A "client" process is any process which is NOT FWR: Puma, Passenger, etc
# and will be using the Faktory Client API only to produce jobs.
Faktory.configure_client do |config|
  config.client_middleware do |chain|
    chain.add SomeClientMiddleware
  end
end

# A "worker" process is a `faktory-worker` process: which is producing and consuming jobs.
# This was called "server" in Sidekiq.
Faktory.configure_worker do |config|
  config.client_middleware do |chain|
    chain.add SomeClientMiddleware
  end
  config.worker_middleware do |chain|
    chain.add SomeWorkerMiddleware
  end
end
Clone this wiki locally