Class: StagedEvent::PublisherProcess

Inherits:
Object
  • Object
show all
Includes:
Technologic
Defined in:
lib/staged_event/publisher_process.rb

Instance Method Summary collapse

Constructor Details

#initialize(publisher) ⇒ PublisherProcess

Returns a new instance of PublisherProcess.



7
8
9
10
# File 'lib/staged_event/publisher_process.rb', line 7

def initialize(publisher)
  @publisher = publisher
  @backoff_timer = BackoffTimer.new
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/staged_event/publisher_process.rb', line 12

def run
  loop do
    sleep(backoff_timer.value)
    publish_next_batch
  end
rescue StandardError => exception
  error :publish_failed, exception: exception.message
  backoff_timer.increment
  retry
rescue SignalException => exception
  error :signal_exception, message: exception.message
end