Class: Lyra::RailsEventStoreAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/lyra/event_store_adapter.rb

Instance Method Summary collapse

Constructor Details

#initializeRailsEventStoreAdapter

Returns a new instance of RailsEventStoreAdapter.



21
22
23
# File 'lib/lyra/event_store_adapter.rb', line 21

def initialize
  @client = build_client
end

Instance Method Details

#publish(event, stream_name:) ⇒ Object



25
26
27
# File 'lib/lyra/event_store_adapter.rb', line 25

def publish(event, stream_name:)
  @client.publish(event, stream_name: stream_name)
end

#read_all_streamsObject



33
34
35
# File 'lib/lyra/event_store_adapter.rb', line 33

def read_all_streams
  @client.read.to_a
end

#read_stream(stream_name) ⇒ Object



29
30
31
# File 'lib/lyra/event_store_adapter.rb', line 29

def read_stream(stream_name)
  @client.read.stream(stream_name).to_a
end

#subscribe(subscriber, to:) ⇒ Object



37
38
39
# File 'lib/lyra/event_store_adapter.rb', line 37

def subscribe(subscriber, to:)
  @client.subscribe(subscriber, to: to)
end