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
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
|