Class: NulogyMessageBusConsumer::Handlers::LogUnprocessedMessages

Inherits:
Object
  • Object
show all
Defined in:
lib/nulogy_message_bus_consumer/handlers/log_unprocessed_messages.rb

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ LogUnprocessedMessages

Returns a new instance of LogUnprocessedMessages.



4
5
6
# File 'lib/nulogy_message_bus_consumer/handlers/log_unprocessed_messages.rb', line 4

def initialize(logger)
  @logger = logger
end

Instance Method Details

#call(message:, **_) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/nulogy_message_bus_consumer/handlers/log_unprocessed_messages.rb', line 8

def call(message:, **_)
  return if ProcessedMessage.exists?(id: message.id)

  @logger.warn(JSON.dump(
    event: "unprocessed_message",
    kafka_message: message.to_h
  ))
end