Class: Alephant::Publisher::Queue::RevalidateProcessor
- Includes:
- Logger
- Defined in:
- lib/alephant/publisher/queue/revalidate_processor.rb
Instance Attribute Summary collapse
-
#http_response_processor ⇒ Object
readonly
Returns the value of attribute http_response_processor.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#url_generator ⇒ Object
readonly
Returns the value of attribute url_generator.
Instance Method Summary collapse
- #consume(message) ⇒ Object
-
#initialize(opts = nil, url_generator, http_response_processor) ⇒ RevalidateProcessor
constructor
A new instance of RevalidateProcessor.
Constructor Details
#initialize(opts = nil, url_generator, http_response_processor) ⇒ RevalidateProcessor
Returns a new instance of RevalidateProcessor.
17 18 19 20 21 |
# File 'lib/alephant/publisher/queue/revalidate_processor.rb', line 17 def initialize(opts = nil, url_generator, http_response_processor) @opts = opts @url_generator = url_generator @http_response_processor = http_response_processor end |
Instance Attribute Details
#http_response_processor ⇒ Object (readonly)
Returns the value of attribute http_response_processor.
15 16 17 |
# File 'lib/alephant/publisher/queue/revalidate_processor.rb', line 15 def http_response_processor @http_response_processor end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
15 16 17 |
# File 'lib/alephant/publisher/queue/revalidate_processor.rb', line 15 def opts @opts end |
#url_generator ⇒ Object (readonly)
Returns the value of attribute url_generator.
15 16 17 |
# File 'lib/alephant/publisher/queue/revalidate_processor.rb', line 15 def url_generator @url_generator end |
Instance Method Details
#consume(message) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/alephant/publisher/queue/revalidate_processor.rb', line 23 def consume() return if .nil? msg_body = () http_response = { renderer_id: msg_body.fetch(:id), http_options: msg_body, http_response: get(), ttl: http_response_processor.ttl(msg_body) } = (, ::JSON.generate(http_response)) write() .delete logger.info(event: 'SQSMessageDeleted', message_content: (), method: "#{self.class}#consume") cache.delete(()) logger.info(event: 'InFlightMessageDeleted', key: (), method: "#{self.class}#consume") end |