Method: MessageBus::Backends::Postgres#initialize

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

#initialize(config = {}, max_backlog_size = 1000) ⇒ Postgres

Returns a new instance of Postgres.

Parameters:

  • config (Hash) (defaults to: {})
  • max_backlog_size (Integer) (defaults to: 1000)

    the largest permitted size (number of messages) for per-channel backlogs; beyond this capacity, old messages will be dropped.

Options Hash (config):

  • :logger (Logger)

    a logger to which logs will be output

  • :clear_every (Integer)

    the interval of publications between which the backlog will not be cleared

  • :backend_options (Hash)

    see PG::Connection.connect for details of which options may be provided



247
248
249
250
251
252
253
254
# File 'lib/message_bus/backends/postgres.rb', line 247

def initialize(config = {}, max_backlog_size = 1000)
  @config = config
  @max_backlog_size = max_backlog_size
  @max_global_backlog_size = 2000
  # after 7 days inactive backlogs will be removed
  @max_backlog_age = 604800
  @clear_every = config[:clear_every] || 1
end