Delayed Redis engine back-end for Faye Ruby server. Enables delivey of messages that were sent before a client has connected to the channel.
Turn this timeline:
…into that:
You can read about the real case scenario for the engine.
Installation
Add this line to your application’s Gemfile
:
gem 'faye-redis-delayed'
Usage
When initializing a new Faye server, reference the engine and pass any required settings.
# faye config.ru
require 'faye'
require 'faye/redis_delayed'
server = Faye::RackAdapter.new(
:mount => '/',
:timeout => 25,
:engine => {
:type => Faye::RedisDelayed, # set the engine type
:expire => 30 # undelivered messages will expire in 30 seconds
# … # other Faye::Redis engine options
}
)
run server
Additional options provided by Faye::DelayedRedis
:
-
:expire
— expire time in seconds, defaults to60
-
:delay_channels
- Array of channels that should be delayed
:delay_channels can be specified as strings or as regular expressions. If something is given, then only channels matching one of the listed patterns will be delayed. Without this argument, every channel is delayed.
:engine => {
:type => Faye::RedisDelayed,
:delay_channels => [/^\/queues_with_this_prefix/, "/this/one/queue"],
}
See the full list of Faye::Redis
engine options.
Contributing
- Fork it
- 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 new Pull Request