-
Notifications
You must be signed in to change notification settings - Fork 74
Getting Started
Mike Perham edited this page Jun 10, 2016
·
29 revisions
Want to run some background jobs in Sidekiq.cr? Let's get you started!
Create a new Crystal application if necessary.
crystal init app sample
Pull in Sidekiq.cr as a dependency into your application in shards.yml
:
dependencies:
sidekiq:
github: mperham/sidekiq.cr
branch: master
Run shards update
to download the Sidekiq source.
In src/sample/workers.cr
:
require "sidekiq"
module Sample
class MyWorker
include Sidekiq::Worker
def perform(x : Int64)
logger.info "hello!"
end
end
end
With Crystal, you build and run a single binary with Sidekiq and all your worker code compiled into it. There is a sample script in examples/sidekiq.cr
which shows how to configure, register your workers and boot Sidekiq.