lib/messaging/adapters/postgres/stream.rb in messaging-3.5.6 vs lib/messaging/adapters/postgres/stream.rb in messaging-3.5.7

- old
+ new

@@ -3,22 +3,29 @@ class Postgres class Stream # @return [String] the name of the stream attr_reader :name + # @return [String] the stream category + attr_reader :category + + # @return [String] the stream id + attr_reader :id + # Should not be used directly. # Use {Messaging.stream} or {Store#stream} # @api private # @see Messaging.stream # @see Store.stream def initialize(name) @name = name + @category, @id = name.split('$') end # Access to all messages in the stream sorted by stream_position # @return [ActiveRecord::Relation] def messages - SerializedMessage.where(stream: name).order(:stream_position) + SerializedMessage.where(stream_category: category, stream_id: id).order(:stream_position) end # The current position of the last message in the stream # @return [-1] if the stream is empty -1 will be returned # @return [Integer] the stream position of the last message in the stream