diff --git a/examples/rdkafka/producer.rb b/examples/rdkafka/producer.rb index 522a17c..b50c1ce 100644 --- a/examples/rdkafka/producer.rb +++ b/examples/rdkafka/producer.rb @@ -4,18 +4,18 @@ require_relative "oauth_token_refresher" module Producer - CLIENTS = {}.freeze + @clients = {} def self.from_name(client_name) - raise "Client not found: #{client_name}\n" if CLIENTS[client_name].nil? + raise "Client not found: #{client_name}\n" if @clients[client_name].nil? - CLIENTS[client_name] + @clients[client_name] end def self.start!(kafka_config) Rdkafka::Config.oauthbearer_token_refresh_callback = method(:refresh_token) @producer = Rdkafka::Config.new(kafka_config).producer(native_kafka_auto_start: false) - CLIENTS[@producer.name] = @producer + @clients[@producer.name] = @producer @producer.start end