module Warren::Callback

Module Warren::Callback provides methods to assist with setting up message broadcast

Public Class Methods

included(base) click to toggle source
# File lib/warren/callback.rb, line 40
def self.included(base)
  base.class_eval do
    extend ClassMethods
  end
end

Public Instance Methods

broadcast() click to toggle source
# File lib/warren/callback.rb, line 46
def broadcast
  # This results in borrowing a connection from the pool
  # per-message. Which isn't ideal. Ideally we'd either
  # check out a connection per thread or per transaction.
  # Any checked out connections will need to be checked back
  # in once the thread/transaction ends with high reliability.
  # So we're doing things the easy way until:
  # 1) Performance requires something more complicated
  # 2) We find a way to achieve the above without monkey-patching
  #    or other complexity (Its probably possible)
  Warren.handler << Warren::Message::Full.new(self)
end