diff --git a/.rubocop.yml b/.rubocop.yml index 9cddfc8..486434f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -19,6 +19,8 @@ AllCops: SuggestExtensions: false TargetRubyVersion: 2.7 TargetRailsVersion: 5.2 + Exclude: + - spec/internal/pkg/**/* RSpec/FilePath: Enabled: false diff --git a/CHANGELOG.md b/CHANGELOG.md index c2af70e..f26d0af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed +## [2.0.1] - 2024-05-08 + +### Fixed + +- Limit the Karafka version to less than `2.4` because they dropped the consumer group mapping + ## [2.0.0] - 2024-01-30 ### Changed diff --git a/lib/sbmt/kafka_consumer/version.rb b/lib/sbmt/kafka_consumer/version.rb index 34adb00..fcbfee6 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.0.0" + VERSION = "2.0.1" end end diff --git a/sbmt-kafka_consumer.gemspec b/sbmt-kafka_consumer.gemspec index bfbbeef..6655195 100644 --- a/sbmt-kafka_consumer.gemspec +++ b/sbmt-kafka_consumer.gemspec @@ -33,7 +33,7 @@ Gem::Specification.new do |spec| spec.add_dependency "rails", ">= 5.2" spec.add_dependency "zeitwerk", "~> 2.3" - spec.add_dependency "karafka", "~> 2.2" + spec.add_dependency "karafka", "~> 2.2", "< 2.4" # [Breaking] Drop the concept of consumer group mapping. spec.add_dependency "yabeda", ">= 0.11" spec.add_dependency "anyway_config", ">= 2.4.0" spec.add_dependency "thor" diff --git a/spec/internal/pkg/client/sso/events/shopper_registration_pb.rb b/spec/internal/pkg/client/sso/events/shopper_registration_pb.rb index 718cb29..a2d148d 100644 --- a/spec/internal/pkg/client/sso/events/shopper_registration_pb.rb +++ b/spec/internal/pkg/client/sso/events/shopper_registration_pb.rb @@ -1,15 +1,37 @@ +# frozen_string_literal: true # Generated by the protocol buffer compiler. DO NOT EDIT! -# source: shopper_registration.proto +# source: sso/events/shopper_registration.proto -require "google/protobuf/timestamp_pb" -Google::Protobuf::DescriptorPool.generated_pool.build do - add_file("shopper_registration.proto", syntax: :proto3) do - add_message "sso.UserRegistration" do - optional :user_uuid, :string, 1 - optional :phone, :string, 2 - optional :created_at, :message, 4, "google.protobuf.Timestamp" +require 'google/protobuf' + +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n%sso/events/shopper_registration.proto\x12\x03sso\x1a\x1fgoogle/protobuf/timestamp.proto\"d\n\x10UserRegistration\x12\x11\n\tuser_uuid\x18\x01 \x01(\t\x12\r\n\x05phone\x18\x02 \x01(\t\x12.\n\ncreated_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x19Z\x17grpc/user_registrationsb\x06proto3" + +pool = Google::Protobuf::DescriptorPool.generated_pool + +begin + pool.add_serialized_file(descriptor_data) +rescue TypeError + # Compatibility code: will be removed in the next major version. + require 'google/protobuf/descriptor_pb' + parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) + parsed.clear_dependency + serialized = parsed.class.encode(parsed) + file = pool.add_serialized_file(serialized) + warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" + imports = [ + ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"], + ] + imports.each do |type_name, expected_filename| + import_file = pool.lookup(type_name).file_descriptor + if import_file.name != expected_filename + warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}" end end + warn "Each proto file must use a consistent fully-qualified name." + warn "This will become an error in the next major version." end module Sso