Method: MessageBus::Backends::Memory#initialize

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

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

Returns a new instance of Memory.

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



191
192
193
194
195
196
197
198
# File 'lib/message_bus/backends/memory.rb', line 191

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
  self.max_backlog_age = 604800
  @clear_every = config[:clear_every] || 1
end