dispatch
Version, currently 0.1.01 version
- 0.1.0latestDec 21, 2016
github.com/bmulvihill/dispatch
In memory queue
30 stars
3 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
dispatch:
github: bmulvihill/dispatch
version: ~> 0.1.0Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- Bryan Mulvihill
Dependencies
This version declares no dependencies.
README
Dispatch 
In-memory job queuing
# example.cr
require "./src/dispatch"
Dispatch.configure do |config|
config.num_workers = 5
config.queue_size = 10
config.logger = Logger.new(IO::Memory.new)
end
class FakeJob
include Dispatchable
def perform(name)
p "#{Time.now}: Hello, #{name}"
end
end
class ErrorJob
include Dispatchable
def perform
raise "Hello!"
end
end
Dispatch.config # => <Dispatch::Configuration:0x1042dafb0 @num_workers=5, @queue_size=10>
FakeJob.dispatch("Bob")
FakeJob.dispatch("Emily")
FakeJob.dispatch_in(5.seconds, "Billy")
FakeJob.dispatch("Maddy")
ErrorJob.dispatch
Dispatch.successes # => 0
sleep 6
Dispatch.successes # => 4
Dispatch.failures # => 1
Output:
"2016-12-13 14:23:53 -0500: Hello, Bob"
"2016-12-13 14:23:53 -0500: Hello, Emily"
"2016-12-13 14:23:53 -0500: Hello, Maddy"
"2016-12-13 14:23:58 -0500: Hello, Billy"
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- Dec 21, 2016
- Commit
c6b2a4fe2a17- Indexed
- yes
Dependents
Repository
github.com/bmulvihill/dispatch
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 25, 2026
- Synced
- Sep 24, 2026
- Versions
- 1