Class: Sqewer::Connection::SendBuffer

Inherits:
MessageBuffer show all
Defined in:
lib/sqewer/connection.rb

Overview

Saves the messages to send to the SQS queue

Constant Summary

Constants inherited from MessageBuffer

MessageBuffer::MAX_RECORDS

Instance Attribute Summary

Attributes inherited from MessageBuffer

#messages

Instance Method Summary collapse

Methods inherited from MessageBuffer

#each_batch, #initialize

Constructor Details

This class inherits a constructor from Sqewer::Connection::MessageBuffer

Instance Method Details

#send_message(message_body, **kwargs_for_send) ⇒ Object



87
88
89
90
91
92
93
# File 'lib/sqewer/connection.rb', line 87

def send_message(message_body, **kwargs_for_send)
  # The "id" is only valid _within_ the request, and is used when
  # an error response refers to a specific ID within a batch
  m = {message_body: message_body, id: messages.length.to_s}
  m[:delay_seconds] = kwargs_for_send[:delay_seconds] if kwargs_for_send[:delay_seconds]
  messages << m
end