Skip to content

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-szalwinski-he committed May 5, 2024
1 parent 3fba4bb commit 6244d01
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/waterdrop/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ source "https://rubygems.org"

gem "aws-msk-iam-sasl-signer"
gem "base64"
gem 'waterdrop'
gem "rexml", "~> 3.2"
gem "waterdrop"
2 changes: 1 addition & 1 deletion examples/waterdrop/oauth_token_refresher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def on_oauthbearer_token_refresh(event)
event[:bearer].oauthbearer_set_token(
token: token.token,
lifetime_ms: token.expiration_time_ms,
principal_name: 'kafka-cluster'
principal_name: "kafka-cluster"
)
end
end
8 changes: 3 additions & 5 deletions examples/waterdrop/producer.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# frozen_string_literal: true

require_relative "oauth_token_refresher"
require 'waterdrop'
require "waterdrop"

module Producer

def self.start!(kafka_config)
@producer = WaterDrop::Producer.new do |config|
config.deliver = true
config.kafka = kafka_config
# can either configure the listener or subscribe to the event
#config.oauth.token_provider_listener = OAuthTokenRefresher.new
# config.oauth.token_provider_listener = OAuthTokenRefresher.new
end

@producer.monitor.subscribe('oauthbearer.token_refresh') do |event|
@producer.monitor.subscribe("oauthbearer.token_refresh") do |event|
OAuthTokenRefresher.new.on_oauthbearer_token_refresh(event)
end

end

def self.produce(**args)
Expand Down

0 comments on commit 6244d01

Please sign in to comment.