Module: CycloneLariat::Outbox::Extensions::SequelOutbox

Defined in:
lib/cyclone_lariat/plugins/outbox/extensions/sequel_outbox.rb

Instance Method Summary collapse

Instance Method Details

#transaction(opts = {}, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cyclone_lariat/plugins/outbox/extensions/sequel_outbox.rb', line 7

def transaction(opts = {}, &block)
  opts = Sequel::OPTS.dup.merge(opts)
  return super unless opts.delete(:with_outbox)

  outbox = CycloneLariat::Outbox.new
  result = super(opts) do |conn|
    block.call(outbox, conn)
  end

  outbox.publish
  result
end