From 26c39834865331f905812cdcc27eab33daa0d946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A2=D0=B0=D1=80=D0=B0=D1=81=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=94=D0=B5=D0=BD=D0=B8=D1=81=20=D0=90=D0=BD=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D0=BB=D1=8C=D0=B5=D0=B2=D0=B8=D1=87?= Date: Wed, 5 Jun 2024 13:05:03 +0000 Subject: [PATCH] [DEX-240605] hotfix: rename from export_batch to process_batch --- CHANGELOG.md | 6 ++++++ README.md | 6 +++--- lib/sbmt/kafka_consumer/base_consumer.rb | 12 ++++++------ lib/sbmt/kafka_consumer/version.rb | 2 +- spec/sbmt/kafka_consumer/base_consumer_spec.rb | 6 +++--- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd0b082..20b87cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed +## [2.3.1] - 2024-06-05 + +### Fixed + +- Rename from `export_batch` to `process_batch` + ## [2.3.0] - 2024-05-30 ### Added diff --git a/README.md b/README.md index 2cfa437..08d22d1 100644 --- a/README.md +++ b/README.md @@ -233,14 +233,14 @@ require_relative "config/environment" some-extra-configuration ``` -### `Export batch` +### `Process batch` -To process messages in batches, you need to add the `export_batch` method in the consumer +To process messages in batches, you need to add the `process_batch` method in the consumer ```ruby # app/consumers/some_consumer.rb class SomeConsumer < Sbmt::KafkaConsumer::BaseConsumer - def export_batch(messages) + def process_batch(messages) # some code end end diff --git a/lib/sbmt/kafka_consumer/base_consumer.rb b/lib/sbmt/kafka_consumer/base_consumer.rb index 887338c..ab432c7 100644 --- a/lib/sbmt/kafka_consumer/base_consumer.rb +++ b/lib/sbmt/kafka_consumer/base_consumer.rb @@ -17,9 +17,9 @@ def self.name def consume ::Rails.application.executor.wrap do - if export_batch? + if process_batch? with_batch_instrumentation(messages) do - export_batch(messages) + process_batch(messages) mark_as_consumed!(messages.last) end else @@ -30,11 +30,11 @@ def consume end end - def export_batch? - if @export_batch_memoized.nil? - @export_batch_memoized = respond_to?(:export_batch) + def process_batch? + if @process_batch_memoized.nil? + @process_batch_memoized = respond_to?(:process_batch) end - @export_batch_memoized + @process_batch_memoized end private diff --git a/lib/sbmt/kafka_consumer/version.rb b/lib/sbmt/kafka_consumer/version.rb index 5fe8389..d63c153 100644 --- a/lib/sbmt/kafka_consumer/version.rb +++ b/lib/sbmt/kafka_consumer/version.rb @@ -2,6 +2,6 @@ module Sbmt module KafkaConsumer - VERSION = "2.3.0" + VERSION = "2.3.1" end end diff --git a/spec/sbmt/kafka_consumer/base_consumer_spec.rb b/spec/sbmt/kafka_consumer/base_consumer_spec.rb index 833bd45..7df2f87 100644 --- a/spec/sbmt/kafka_consumer/base_consumer_spec.rb +++ b/spec/sbmt/kafka_consumer/base_consumer_spec.rb @@ -97,8 +97,8 @@ def process_message(_message) let(:consumer_class) do Class.new(described_class.consumer_klass) do attr_reader :consumed - def export_batch(messages) - Rails.logger.info "Export batch #{messages.count} messages" + def process_batch(messages) + Rails.logger.info "Process batch #{messages.count} messages" @consumed = true end @@ -119,7 +119,7 @@ def consumed? it "consumes" do consume_with_sbmt_karafka expect(consumer).to be_consumed - expect(Rails.logger).to have_received(:info).with(/Export batch/) + expect(Rails.logger).to have_received(:info).with(/Process batch/) end end end