Class: Igniter::Store::ChangefeedBuffer::Subscription

Inherits:
Object
  • Object
show all
Defined in:
lib/igniter/store/changefeed_buffer.rb

Overview

Returned by #subscribe. Call #close to stop delivery and release resources. Close behavior is governed by the buffer’s close_policy:

  • :drain — pending events are delivered before worker stops.

  • :discard — pending events are dropped; worker stops after current event.

Calling #close is idempotent.

Instance Method Summary collapse

Constructor Details

#initialize(record, buffer) ⇒ Subscription

Returns a new instance of Subscription.



170
171
172
173
# File 'lib/igniter/store/changefeed_buffer.rb', line 170

def initialize(record, buffer)
  @record = record
  @buffer = buffer
end

Instance Method Details

#closeObject



175
176
177
178
# File 'lib/igniter/store/changefeed_buffer.rb', line 175

def close
  @buffer.__send__(:remove_record, @record)
  @record.thread&.join(2) rescue nil
end