Skip to content

Commit

Permalink
Demonstrate out of box support for em-synchrony
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo committed Feb 18, 2011
1 parent 3db7fea commit 5791f33
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Expand Up @@ -14,6 +14,9 @@ group :example do
gem 'activerecord', '3.0.4'
gem 'mysql2'

gem 'em-http-request'
gem 'em-synchrony'

gem 'rainbows'
gem 'yajl-ruby', :require => 'yajl'
gem 'http_router'
Expand Down
10 changes: 10 additions & 0 deletions Gemfile.lock
Expand Up @@ -19,9 +19,17 @@ GEM
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activesupport (3.0.4)
addressable (2.2.4)
arel (2.0.8)
builder (2.1.2)
daemons (1.1.0)
em-http-request (0.3.0)
addressable (>= 2.0.0)
escape_utils
eventmachine (>= 0.12.9)
em-synchrony (0.2.0)
eventmachine (>= 0.12.9)
escape_utils (0.2.0)
eventmachine (0.12.10)
http_router (0.5.3)
rack (>= 1.0.0)
Expand Down Expand Up @@ -52,6 +60,8 @@ DEPENDENCIES
activerecord (= 3.0.4)
activesupport (= 3.0.4)
cramp!
em-http-request
em-synchrony
eventmachine (~> 0.12.10)
http_router
mysql2
Expand Down
21 changes: 21 additions & 0 deletions examples/fibers/synchrony_http.ru
@@ -0,0 +1,21 @@
require "rubygems"
require "bundler"
Bundler.setup(:default, :example)

require 'cramp'
require 'em-http-request'
require 'em-synchrony/em-http'

class SynchronyController < Cramp::Action
use_fiber_pool

def start
page = EventMachine::HttpRequest.new("http://m.onkey.org").get
render page.response
finish
end
end

# bundle exec thin -V -R examples/fibers/synchrony_http.ru start
# bundle exec rainbows -E deployment -c examples/rainbows.conf examples/fibers/synchrony_http.ru
run SynchronyController

0 comments on commit 5791f33

Please sign in to comment.