Class: Sqewer::Connection::MessageBuffer

Inherits:
Struct
  • Object
show all
Defined in:
lib/sqewer/connection.rb

Overview

Stores the messages for the SQS queue (both deletes and sends), and yields them in allowed batch sizes

Direct Known Subclasses

DeleteBuffer, SendBuffer

Constant Summary collapse

MAX_RECORDS =
10

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMessageBuffer

Returns a new instance of MessageBuffer.



77
78
79
# File 'lib/sqewer/connection.rb', line 77

def initialize
  super([])
end

Instance Attribute Details

#messagesObject

Returns the value of attribute messages

Returns:

  • (Object)

    the current value of messages



75
76
77
# File 'lib/sqewer/connection.rb', line 75

def messages
  @messages
end

Instance Method Details

#each_batchObject



80
81
82
# File 'lib/sqewer/connection.rb', line 80

def each_batch
  messages.each_slice(MAX_RECORDS){|batch| yield(batch)}
end