Class: Karafka::Processing::Schedulers::Default

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/processing/schedulers/default.rb

Overview

FIFO scheduler for messages coming from various topics and partitions

Instance Method Summary collapse

Constructor Details

#initialize(queue) ⇒ Default

Returns a new instance of Default.

Parameters:



10
11
12
# File 'lib/karafka/processing/schedulers/default.rb', line 10

def initialize(queue)
  @queue = queue
end

Instance Method Details

#on_clear(_group_id) ⇒ Object

This scheduler does not need to be cleared because it is stateless

Parameters:

  • _group_id (String)

    Subscription group id



37
38
39
# File 'lib/karafka/processing/schedulers/default.rb', line 37

def on_clear(_group_id)
  nil
end

#on_manageObject

This scheduler does not have anything to manage as it is a pass through and has no state



30
31
32
# File 'lib/karafka/processing/schedulers/default.rb', line 30

def on_manage
  nil
end

#on_schedule_consumption(jobs_array) ⇒ Object Also known as: on_schedule_revocation, on_schedule_shutdown, on_schedule_idle, on_schedule_eofed

Schedules jobs in the fifo order

Parameters:



17
18
19
20
21
# File 'lib/karafka/processing/schedulers/default.rb', line 17

def on_schedule_consumption(jobs_array)
  jobs_array.each do |job|
    @queue << job
  end
end