sbmt-kafka_consumer 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +3 -3
- data/lib/sbmt/kafka_consumer/base_consumer.rb +6 -6
- data/lib/sbmt/kafka_consumer/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 903e47e49b20391d11feb8f0f278b52ff6e765daa3a5fa27b50e7e673612d5db
         | 
| 4 | 
            +
              data.tar.gz: 95c9e87e8a1dde1c85d1266166694e0b06d82c645cd5affcb4f06200bb66d4af
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 40aef0b43f7e39c7f61c32a2bd226893988970ad9d0be02692c12fdfaae06553d56d0464aff307b3a01445c0e683f90eb219768289aedea6423671a2f6e06136
         | 
| 7 | 
            +
              data.tar.gz: 6fe8bc839e28521bc8795aca004e3dbc0f79bda8d18c2844c01e3ac9d12bdbccb29be894dff8b5ddeb073ae7bcf7e20cfb189b76a2c349aada1457a4f8f857ae
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -233,14 +233,14 @@ require_relative "config/environment" | |
| 233 233 | 
             
            some-extra-configuration
         | 
| 234 234 | 
             
            ```
         | 
| 235 235 |  | 
| 236 | 
            -
            ### ` | 
| 236 | 
            +
            ### `Process batch`
         | 
| 237 237 |  | 
| 238 | 
            -
            To process messages in batches, you need to add the ` | 
| 238 | 
            +
            To process messages in batches, you need to add the `process_batch` method in the consumer
         | 
| 239 239 |  | 
| 240 240 | 
             
            ```ruby
         | 
| 241 241 | 
             
            # app/consumers/some_consumer.rb
         | 
| 242 242 | 
             
            class SomeConsumer < Sbmt::KafkaConsumer::BaseConsumer
         | 
| 243 | 
            -
              def  | 
| 243 | 
            +
              def process_batch(messages)
         | 
| 244 244 | 
             
                # some code 
         | 
| 245 245 | 
             
              end
         | 
| 246 246 | 
             
            end
         | 
| @@ -17,9 +17,9 @@ module Sbmt | |
| 17 17 |  | 
| 18 18 | 
             
                  def consume
         | 
| 19 19 | 
             
                    ::Rails.application.executor.wrap do
         | 
| 20 | 
            -
                      if  | 
| 20 | 
            +
                      if process_batch?
         | 
| 21 21 | 
             
                        with_batch_instrumentation(messages) do
         | 
| 22 | 
            -
                           | 
| 22 | 
            +
                          process_batch(messages)
         | 
| 23 23 | 
             
                          mark_as_consumed!(messages.last)
         | 
| 24 24 | 
             
                        end
         | 
| 25 25 | 
             
                      else
         | 
| @@ -30,11 +30,11 @@ module Sbmt | |
| 30 30 | 
             
                    end
         | 
| 31 31 | 
             
                  end
         | 
| 32 32 |  | 
| 33 | 
            -
                  def  | 
| 34 | 
            -
                    if @ | 
| 35 | 
            -
                      @ | 
| 33 | 
            +
                  def process_batch?
         | 
| 34 | 
            +
                    if @process_batch_memoized.nil?
         | 
| 35 | 
            +
                      @process_batch_memoized = respond_to?(:process_batch)
         | 
| 36 36 | 
             
                    end
         | 
| 37 | 
            -
                    @ | 
| 37 | 
            +
                    @process_batch_memoized
         | 
| 38 38 | 
             
                  end
         | 
| 39 39 |  | 
| 40 40 | 
             
                  private
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: sbmt-kafka_consumer
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.3. | 
| 4 | 
            +
              version: 2.3.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sbermarket Ruby-Platform Team
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024-06- | 
| 11 | 
            +
            date: 2024-06-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         |