Module: Warren::Callback

Defined in:
lib/warren/callback.rb,
lib/warren/callback/broadcast_with_warren.rb,
lib/warren/callback/broadcast_associated_with_warren.rb

Overview

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

Defined Under Namespace

Modules: ClassMethods Classes: BroadcastAssociatedWithWarren, BroadcastWithWarren

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



40
41
42
43
44
# File 'lib/warren/callback.rb', line 40

def self.included(base)
  base.class_eval do
    extend ClassMethods
  end
end

Instance Method Details

#broadcastObject



46
47
48
49
50
51
52
53
54
55
56
57
# 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