Skip to content

Commit

Permalink
fix missing available_events method (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
mensfeld authored Nov 9, 2024
1 parent 4c8c8ae commit cc26a05
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 2.4.5 (Unreleased)
- **[Breaking]** Drop Ruby `3.0` support according to the EOL schedule.
- [Fix] Restore `#available_events` notifications bus method.
- [Change] Set minimum `karafka-rdkafka` on `0.17.6` to support new features.

## 2.4.4 (2024-07-20)
Expand Down
5 changes: 5 additions & 0 deletions lib/karafka/core/monitoring/notifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def initialize
@events_methods_map = {}
end

# @return [Array<String>] list of available events
def available_events
@events_methods_map.keys
end

# Registers a new event on which we can publish
#
# @param event_id [String] event id
Expand Down
5 changes: 4 additions & 1 deletion spec/lib/karafka/core/monitoring/notifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ def on_message_produced_async(_event)
end
end

describe '#clear' do
describe '#available_events' do
it { expect(notifications.available_events).to eq([event_name]) }
end

describe '#clear' do
describe 'without an argument' do
before { notifications.subscribe(event_name) { raise } }

Expand Down

0 comments on commit cc26a05

Please sign in to comment.