Class: GovukMessageQueueConsumer::HeartbeatProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/govuk_message_queue_consumer/heartbeat_processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(next_processor) ⇒ HeartbeatProcessor

Returns a new instance of HeartbeatProcessor.



3
4
5
# File 'lib/govuk_message_queue_consumer/heartbeat_processor.rb', line 3

def initialize(next_processor)
  @next_processor = next_processor
end

Instance Method Details

#process(message) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/govuk_message_queue_consumer/heartbeat_processor.rb', line 7

def process(message)
  # Ignore heartbeat messages
  if message.headers.content_type == "application/x-heartbeat"
    message.ack
  else
    @next_processor.process(message)
  end
end