Module: Consumer::Controls::Subscription

Defined in:
lib/consumer/controls/subscription.rb

Class Method Summary collapse

Class Method Details

.example(next_batch: nil, batch: nil, position: nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/consumer/controls/subscription.rb', line 4

def self.example(next_batch: nil, batch: nil, position: nil)
  stream_name = StreamName.example

  get = Get.example

  unless batch.nil?
    get.set_batch(stream_name, batch, position)
  end

  subscription = ::Consumer::Subscription.new(stream_name, get)

  subscription.position = position if position

  unless next_batch.nil?
    subscription.next_batch = next_batch
  end

  subscription
end