class Consumer::EventStore::PositionStore
Public Class Methods
build(stream_name, session: nil, consumer_identifier: nil)
click to toggle source
# File lib/consumer/event_store/position_store.rb, line 12 def self.build(stream_name, session: nil, consumer_identifier: nil) position_stream_name = StreamName.get(stream_name, consumer_identifier: consumer_identifier) instance = new(position_stream_name) MessageStore::EventStore::Session.configure(instance, session: session) instance.configure instance end
Public Instance Methods
configure()
click to toggle source
# File lib/consumer/event_store/position_store.rb, line 21 def configure MessageStore::EventStore::Get::Last.configure(self, session: session) Messaging::EventStore::Write.configure(self, session: session) end
get()
click to toggle source
# File lib/consumer/event_store/position_store.rb, line 26 def get message_data = get_last.(stream_name) return nil if message_data.nil? message = Messaging::Message::Import.(message_data, Updated) message.position end
put(position)
click to toggle source
# File lib/consumer/event_store/position_store.rb, line 35 def put(position) message = Updated.new message.position = position write.(message, stream_name) end