Method: MessageBus::Implementation#backlog

Defined in:
lib/message_bus.rb

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

Get messages from a channel backlog since the last ID specified, filtered by site

Parameters:

  • channel (String) (defaults to: nil)

    the name of the channel in question

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

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

  • site_id (String) (defaults to: nil)

    the ID of the site by which to filter

Returns:

  • (Array<MessageBus::Message>)

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



486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/message_bus.rb', line 486

def backlog(channel = nil, last_id = nil, site_id = nil)
  old =
    if channel
      backend_instance.backlog(encode_channel_name(channel, site_id), last_id)
    else
      backend_instance.global_backlog(last_id)
    end

  old.each do |m|
    decode_message!(m)
  end
  old
end