Class: Karafka::Instrumentation::Callbacks::OauthbearerTokenRefresh
- Inherits:
-
Object
- Object
- Karafka::Instrumentation::Callbacks::OauthbearerTokenRefresh
- Defined in:
- lib/karafka/instrumentation/callbacks/oauthbearer_token_refresh.rb
Overview
Callback that is triggered when oauth token needs to be refreshed.
Instance Method Summary collapse
- #call(_rd_config, bearer_name) ⇒ Object
-
#initialize(bearer) ⇒ OauthbearerTokenRefresh
constructor
A new instance of OauthbearerTokenRefresh.
Constructor Details
#initialize(bearer) ⇒ OauthbearerTokenRefresh
Returns a new instance of OauthbearerTokenRefresh.
15 16 17 |
# File 'lib/karafka/instrumentation/callbacks/oauthbearer_token_refresh.rb', line 15 def initialize(bearer) @bearer = bearer end |
Instance Method Details
#call(_rd_config, bearer_name) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/karafka/instrumentation/callbacks/oauthbearer_token_refresh.rb', line 21 def call(_rd_config, bearer_name) return unless @bearer.name == bearer_name monitor.instrument( 'oauthbearer.token_refresh', bearer: @bearer, caller: self ) rescue StandardError => e monitor.instrument( 'error.occurred', caller: self, type: 'callbacks.oauthbearer_token_refresh.error', error: e ) end |