Method: MessageBus::Backends::Postgres#global_backlog

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

#global_backlog(last_id = 0) ⇒ Array<MessageBus::Message>

Get messages from the global backlog

Parameters:

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

    the global ID of the last message that the caller received

Returns:

  • (Array<MessageBus::Message>)

    all messages published on any channel since the specified last ID



308
309
310
311
312
313
314
# File 'lib/message_bus/backends/postgres.rb', line 308

def global_backlog(last_id = 0)
  items = client.global_backlog last_id.to_i

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