Sha256: ecdac07c3dd4ca518971e040a756b808c18d7977e050cb39fa68d7af7da01b90
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'alephant/broker/models/request_factory' require 'alephant/broker/models/response_factory' module Alephant module Broker class RequestHandler include Logger def initialize(config) @env = RequestStore.store[:env] @request = RequestFactory.process(request_type) @response_factory = ResponseFactory.new(config) end def process begin @response_factory.response_from(@request) rescue Exception => e logger.info("Broker.requestHandler.process: Exception raised (#{e.message})") @response_factory.response(500) end end private def request_type case @env.path.split('/')[1] when 'components' component_type when 'status' :status else :notfound end end def component_type case @env.method when 'POST' :component_batch when 'GET' :component end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alephant-broker-0.1.0 | lib/alephant/broker/models/request_handler.rb |