Class: DaimonSkycrawlers::Consumer::HTTPResponse
- Includes:
- SongkickQueue::Consumer
- Defined in:
- lib/daimon_skycrawlers/consumer/http_response.rb
Overview
HTTP response consumer class
Class Method Summary collapse
- .default_processor ⇒ Object
- .processors ⇒ Object
- .queue_name ⇒ Object
-
.register(processor = nil, &block) ⇒ Object
Register a processor.
Instance Method Summary collapse
Methods included from DaimonSkycrawlers::ConfigMixin
Methods included from LoggerMixin
Class Method Details
.default_processor ⇒ Object
46 47 48 |
# File 'lib/daimon_skycrawlers/consumer/http_response.rb', line 46 def default_processor DaimonSkycrawlers::Processor::Default.new end |
.processors ⇒ Object
39 40 41 |
# File 'lib/daimon_skycrawlers/consumer/http_response.rb', line 39 def processors @processors ||= [] end |
.queue_name ⇒ Object
53 54 55 |
# File 'lib/daimon_skycrawlers/consumer/http_response.rb', line 53 def queue_name "#{DaimonSkycrawlers.configuration.queue_name_prefix}.http-response" end |
.register(processor) ⇒ void .register {|message| ... } ⇒ void
Register a processor
28 29 30 31 32 33 34 |
# File 'lib/daimon_skycrawlers/consumer/http_response.rb', line 28 def register(processor = nil, &block) if block_given? processors << block else processors << processor end end |
Instance Method Details
#process(message) ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/daimon_skycrawlers/consumer/http_response.rb', line 63 def process() if self.class.processors.empty? processors = [self.class.default_processor] else processors = self.class.processors end processors.each do |processor| processor.process() end end |