class EventSource::EventStore::HTTP::Get::Last
Constants
- Assertions
Public Class Methods
build(session: nil)
click to toggle source
# File lib/event_source/event_store/http/get/last.rb, line 13 def self.build(session: nil) instance = new instance.configure session: session instance end
call(stream_name, **build_arguments)
click to toggle source
# File lib/event_source/event_store/http/get/last.rb, line 19 def self.call(stream_name, **build_arguments) instance = build **build_arguments instance.(stream_name) end
Public Instance Methods
call(stream_name)
click to toggle source
# File lib/event_source/event_store/http/get/last.rb, line 36 def call(stream_name) logger.trace { "Getting last event of stream (StreamName: #{stream_name})" } begin event, * = read_stream.( stream_name, position: :head, direction: :backward, batch_size: 1 ) rescue ::EventStore::HTTP::ReadStream::StreamNotFoundError end logger.debug { "Got last event of stream (StreamName: #{stream_name}, EventType: #{event&.type.inspect}, Position: #{event&.position.inspect}, GlobalPosition: #{event&.global_position.inspect})" } event end
configure(session: nil)
click to toggle source
# File lib/event_source/event_store/http/get/last.rb, line 24 def configure(session: nil) session = Session.configure self, session: session read_stream = ::EventStore::HTTP::ReadStream.configure( self, session: session ) read_stream.embed_body read_stream.output_schema = Result end