class RackRabbit::Handler
Attributes
app[R]
config[R]
logger[R]
Public Class Methods
new(app, config)
click to toggle source
# File lib/rack-rabbit/handler.rb, line 12 def initialize(app, config) @app = app @config = config @logger = config.logger end
Public Instance Methods
handle(message)
click to toggle source
# File lib/rack-rabbit/handler.rb, line 20 def handle(message) env = message.get_rack_env(config.rack_env) status, headers, body_chunks = app.call(env) body = [] body_chunks.each{|c| body << c } body_chunks.close if body_chunks.respond_to?(:close) Response.new(status, headers, body.join) rescue Exception => e # don't let exceptions bubble out of worker process logger.error e logger.error e.backtrace.join("\n") Response.new(500, {}, "Internal Server Error") end