Rails/Rack middleware for batching circuitry notifications.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install circuitry-middleware
Ruby on Rails 4.x
If using this gem in the context of a Ruby on Rails application, there's nothing
more that you need to do beyond including the gem in your
If you do not have a
Gemfile or you're explicitly setting
Gemfile, then you'll need to require the gem within an
Ruby on Rails 3.x
If your application does not use either of the
Rack::ConditionalGet middleware components (check via
rake middleware), then
you can follow the Rails 4.x directions above.
If your application does use either of these middleware components, then this gem must be implemented in a different manner due to an older Rack dependency that improperly implements these pieces of middleware.
First, in your
gem 'circuitry-middleware', require: false
Then in your
require 'circuitry/middleware/rack' config.middleware.insert_before Rack::ConditionalGet, Circuitry::Middleware::Rack
If using this gem in the context of a Rack application, you'll need to explicitly
include the middleware as a part of your Rackup file (generally
require 'circuitry-middleware' use Circuitry::Middleware
By default, this gem utilizes batching when publishing and threading when subscribing. These options can be overridden by swapping the middleware.
config.middleware.swap Circuitry::Middleware::Rack, Circuitry::Middleware::Rack, publish_async_strategy: :fork, subscribe_async_strategy: :fork
Please refer to the circuitry gem for more insight on asynchronous options.
After checking out the repo, run
bin/setup to install dependencies. Then, run
bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run
bundle exec rake install. To
release a new version, update the version number in
version.rb, and then run
bundle exec rake release to create a git tag for the version, push git commits
and tags, and push the
.gem file to rubygems.org.
- Fork it ( https://github.com/kapost/circuitry-middleware/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