Class: Consumer::Controls::Get::Incrementing

Inherits:
Object
  • Object
show all
Defined in:
lib/consumer/controls/get/incrementing.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(sleep_duration) ⇒ Object



9
10
11
# File 'lib/consumer/controls/get/incrementing.rb', line 9

def self.build(sleep_duration)
  new(sleep_duration)
end

Instance Method Details

#call(stream_name, position: nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/consumer/controls/get/incrementing.rb', line 13

def call(stream_name, position: nil)
  position ||= 0

  sleep Rational(sleep_duration, 1000)

  3.times.map do |offset|
    MessageData.get(
      stream_name,
      position + offset,
      offset
    )
  end
end