Method: OnStomp::Failover::Buffers::Receipts#initialize
- Defined in:
- lib/onstomp/failover/buffers/receipts.rb
#initialize(failover) ⇒ Receipts
Returns a new instance of Receipts.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/onstomp/failover/buffers/receipts.rb', line 10 def initialize failover super [:send, :commit, :abort, :subscribe].each do |ev| failover.__send__(:"before_#{ev}") do |f, *_| add_to_buffer f, {:receipt => OnStomp.next_serial} end end failover.before_begin do |f, *_| add_to_transactions f, {:receipt => OnStomp.next_serial} end # We can scrub the subscription before UNSUBSCRIBE is fully written # because if we replay before UNSUBSCRIBE was sent, we still don't # want to be subscribed when we reconnect. failover.before_unsubscribe do |f, *_| remove_subscribe_from_buffer f end failover.on_receipt { |r, *_| debuffer_frame r } failover.on_failover_connected { |f,c,*_| replay_buffer c } end |