Method: MessageBus::Backends::Memory#backlog

Defined in:
lib/message_bus/backends/memory.rb

#backlog(channel, last_id = 0) ⇒ Array<MessageBus::Message>

Get messages from a channel backlog

Parameters:

  • channel (String)

    the name of the channel in question

  • last_id (#to_i) (defaults to: 0)

    the channel-specific ID of the last message that the caller received on the specified channel

Returns:

  • (Array<MessageBus::Message>)

    all messages published to the specified channel since the specified last ID



244
245
246
247
248
249
250
# File 'lib/message_bus/backends/memory.rb', line 244

def backlog(channel, last_id = 0)
  items = client.backlog channel, last_id.to_i

  items.map! do |id, data|
    MessageBus::Message.new id, id, channel, data
  end
end