redis-queue
Version, currently 0.1.02 versions
- 0.1.1latestMay 11, 2019
- 0.1.0not indexedMay 11, 2019
github.com/parruda/redis-queue.cr
Crystal implementation of the reliable queue pattern using Redis
Nothing has been indexed for 0.1.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
redis-queue:
github: parruda/redis-queue.cr
version: ~> 0.1.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
redis-queue.cr
Based on the Ruby version: https://github.com/taganaka/redis-queue
Adds Redis::Queue class which can be used as Distributed-Queue based on Redis. Redis is often used as a messaging server to implement processing of background jobs or other kinds of messaging tasks. It implements Reliable-queue pattern decribed here: http://redis.io/commands/rpoplpush.
Installation
- Add the dependency to your
shard.yml:
dependencies:
redis-queue:
github: parruda/redis-queue.cr
- Run
shards install
Usage
require "redis-queue"
redis = Redis.new
queue = Redis::Queue.new('q_test','bp_q_test', :redis => redis)
# Adding some elements
queue.push "a"
queue.push "b"
# Process messages
# By default, calling pop method is a blocking operation
# Your code will wait here for a new message
while message=queue.pop
# Remove message from the backup queue if the message has been processed without errors
queue.commit if YourTask.new(message).perform.succeed?
end
# Process messages using block
queue.process(force_commit: false) do |message|
# queue.commit is called if last statement of the block returns true
# or force_commit = true
YourTask.new(message).perform.succeed?
end
# Process messages with timeout (starting from version 0.0.3)
# Wait for 15 seconds for new messages, then exit
queue.process(force_commit: false, timeout: 15) do |message|
puts "'#{message}'"
end
# Process messages in a non blocking-way
# A soon as the queue is empty, the block will exit
queue.process(blocking: false) do |message|
puts "'#{message}'"
end
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/your-github-user/redis-queue/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Paulo Arruda - creator and maintainer
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
- May 11, 2019
- Commit
721f5e97dfce- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/parruda/redis-queue.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 2