Module: Consumer::EventStore

Included in:
Controls::Consumer::Example, Controls::Consumer::Incrementing
Defined in:
lib/consumer/event_store/event_store.rb,
lib/consumer/event_store/copy_session.rb,
lib/consumer/event_store/position_store.rb,
lib/consumer/event_store/controls/handle.rb,
lib/consumer/event_store/controls/category.rb,
lib/consumer/event_store/controls/consumer.rb,
lib/consumer/event_store/controls/stream_name.rb,
lib/consumer/event_store/controls/message_data.rb,
lib/consumer/event_store/position_store/updated.rb,
lib/consumer/event_store/controls/position_stream.rb,
lib/consumer/event_store/position_store/stream_name.rb

Defined Under Namespace

Modules: Controls, CopySession Classes: PositionStore

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(cls) ⇒ Object



3
4
5
6
7
# File 'lib/consumer/event_store/event_store.rb', line 3

def self.included(cls)
  cls.class_exec do
    include Consumer
  end
end

Instance Method Details

#configure(session: nil, batch_size: nil, position_store: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/consumer/event_store/event_store.rb', line 9

def configure(session: nil, batch_size: nil, position_store: nil)
  cycle_timeout = cycle_timeout_milliseconds || Consumer::Subscription::Defaults.cycle_timeout_milliseconds

  long_poll_duration = Rational(cycle_timeout, 1000).ceil

  unless session.nil?
    get_session = CopySession.(session)
  end

  MessageStore::EventStore::Get.configure(
    self,
    batch_size: batch_size,
    long_poll_duration: long_poll_duration,
    session: get_session
  )

  PositionStore.configure(
    self,
    stream_name,
    session: session,
    position_store: position_store
  )
end