Module: MessageStore::Postgres::Get::Call

Defined in:
lib/message_store/postgres/get.rb

Instance Method Summary collapse

Instance Method Details

#call(position = nil, stream_name: nil) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/message_store/postgres/get.rb', line 55

def call(position=nil, stream_name: nil)
  position ||= self.class::Defaults.position

  stream_name ||= self.stream_name

  assure

  logger.trace(tag: :get) { "Getting message data (#{log_text(stream_name, position)})" }

  result = get_result(stream_name, position)

  message_data = convert(result)

  logger.info(tag: :get) { "Finished getting message data (Count: #{message_data.length}, #{log_text(stream_name, position)})" }
  logger.info(tags: [:data, :message_data]) { message_data.pretty_inspect }

  message_data
end