Class: Karafka::Processing::WorkersBatch
- Inherits:
 - 
      Object
      
        
- Object
 - Karafka::Processing::WorkersBatch
 
 
- Includes:
 - Enumerable
 
- Defined in:
 - lib/karafka/processing/workers_batch.rb
 
Overview
Abstraction layer around workers batch.
Instance Method Summary collapse
- 
  
    
      #each(&block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Iterates over available workers and yields each worker.
 - #initialize(jobs_queue) ⇒ WorkersBatch constructor
 - 
  
    
      #size  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    
Number of workers in the batch.
 
Constructor Details
#initialize(jobs_queue) ⇒ WorkersBatch
      14 15 16  | 
    
      # File 'lib/karafka/processing/workers_batch.rb', line 14 def initialize(jobs_queue) @batch = Array.new(concurrency) { Processing::Worker.new(jobs_queue) } end  | 
  
Instance Method Details
#each(&block) ⇒ Object
Iterates over available workers and yields each worker
      20 21 22  | 
    
      # File 'lib/karafka/processing/workers_batch.rb', line 20 def each(&block) @batch.each(&block) end  | 
  
#size ⇒ Integer
Returns number of workers in the batch.
      25 26 27  | 
    
      # File 'lib/karafka/processing/workers_batch.rb', line 25 def size @batch.size end  |