Class: Karafka::Processing::Jobs::Shutdown

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/processing/jobs/shutdown.rb

Overview

Job that runs on each active consumer upon process shutdown (one job per consumer).

Instance Attribute Summary

Attributes inherited from Base

#executor

Instance Method Summary collapse

Methods inherited from Base

#after_call, #before_call, #finish!, #finished?, #non_blocking?, #wrap

Constructor Details

#initialize(executor) ⇒ Shutdown

Parameters:



13
14
15
16
# File 'lib/karafka/processing/jobs/shutdown.rb', line 13

def initialize(executor)
  @executor = executor
  super()
end

Instance Method Details

#before_scheduleObject

Runs code prior to scheduling this shutdown job



19
20
21
# File 'lib/karafka/processing/jobs/shutdown.rb', line 19

def before_schedule
  executor.before_schedule_shutdown
end

#callObject

Runs the shutdown job via an executor.



24
25
26
# File 'lib/karafka/processing/jobs/shutdown.rb', line 24

def call
  executor.shutdown
end