Class: Karafka::Messages::BatchMetadata
- Inherits:
 - 
      Struct
      
        
- Object
 - Struct
 - Karafka::Messages::BatchMetadata
 
 
- Defined in:
 - lib/karafka/messages/batch_metadata.rb
 
Overview
This metadata object refers to per batch metadata, not ‘#message.metadata`
Simple batch metadata object that stores all non-message information received from Kafka cluster while fetching the data.
Instance Attribute Summary collapse
- 
  
    
      #created_at  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute created_at.
 - 
  
    
      #deserializers  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute deserializers.
 - 
  
    
      #first_offset  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute first_offset.
 - 
  
    
      #last_offset  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute last_offset.
 - 
  
    
      #partition  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute partition.
 - 
  
    
      #processed_at  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute processed_at.
 - 
  
    
      #scheduled_at  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute scheduled_at.
 - 
  
    
      #size  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute size.
 - 
  
    
      #topic  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute topic.
 
Instance Method Summary collapse
- 
  
    
      #consumption_lag  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    
This lag describes how long did it take for a message to be consumed from the moment it was created.
 - 
  
    
      #processing_lag  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    
This lag describes how long did a batch have to wait before it was picked up by one of the workers.
 
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at
      9 10 11  | 
    
      # File 'lib/karafka/messages/batch_metadata.rb', line 9 def created_at @created_at end  | 
  
#deserializers ⇒ Object
Returns the value of attribute deserializers
      9 10 11  | 
    
      # File 'lib/karafka/messages/batch_metadata.rb', line 9 def deserializers @deserializers end  | 
  
#first_offset ⇒ Object
Returns the value of attribute first_offset
      9 10 11  | 
    
      # File 'lib/karafka/messages/batch_metadata.rb', line 9 def first_offset @first_offset end  | 
  
#last_offset ⇒ Object
Returns the value of attribute last_offset
      9 10 11  | 
    
      # File 'lib/karafka/messages/batch_metadata.rb', line 9 def last_offset @last_offset end  | 
  
#partition ⇒ Object
Returns the value of attribute partition
      9 10 11  | 
    
      # File 'lib/karafka/messages/batch_metadata.rb', line 9 def partition @partition end  | 
  
#processed_at ⇒ Object
Returns the value of attribute processed_at
      9 10 11  | 
    
      # File 'lib/karafka/messages/batch_metadata.rb', line 9 def processed_at @processed_at end  | 
  
#scheduled_at ⇒ Object
Returns the value of attribute scheduled_at
      9 10 11  | 
    
      # File 'lib/karafka/messages/batch_metadata.rb', line 9 def scheduled_at @scheduled_at end  | 
  
#size ⇒ Object
Returns the value of attribute size
      9 10 11  | 
    
      # File 'lib/karafka/messages/batch_metadata.rb', line 9 def size @size end  | 
  
#topic ⇒ Object
Returns the value of attribute topic
      9 10 11  | 
    
      # File 'lib/karafka/messages/batch_metadata.rb', line 9 def topic @topic end  | 
  
Instance Method Details
#consumption_lag ⇒ Integer
In case of usage in workless flows, this value will be set to -1
This lag describes how long did it take for a message to be consumed from the moment it was created
      27 28 29  | 
    
      # File 'lib/karafka/messages/batch_metadata.rb', line 27 def consumption_lag processed_at ? time_distance_in_ms(processed_at, created_at) : -1 end  | 
  
#processing_lag ⇒ Integer
In case of usage in workless flows, this value will be set to -1
This lag describes how long did a batch have to wait before it was picked up by one of the workers
      36 37 38  | 
    
      # File 'lib/karafka/messages/batch_metadata.rb', line 36 def processing_lag processed_at ? time_distance_in_ms(processed_at, scheduled_at) : -1 end  |