Method: MessageBus::Backends::Postgres#backlog

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

#backlog(channel, last_id = 0) ⇒ Integer

Get the ID of the last message published on a channel

Parameters:

  • channel (String)

    the name of the channel in question

Returns:

  • (Integer)

    the channel-specific ID of the last message published to the given channel



299
300
301
302
303
304
305
# File 'lib/message_bus/backends/postgres.rb', line 299

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