You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use dry-monitor together with dry-events in karafka. In order to provide a "safe" API (safe in terms of typo mistakes etc) we've implemented two additional methods for the monitor that could be useful when working with it. Would it fit as a PR in this library?
# Allows us to subscribe to events with a code that will be yielded upon events# @param event_name_or_listener [String, Object] name of the event we want to subscribe to# or a listener if we decide to go with object listenerdefsubscribe(event_name_or_listener)returnsuperunlessevent_name_or_listener.is_a?(String)returnsuperifavailable_events.include?(event_name_or_listener)raiseErrors::UnregisteredMonitorEvent,event_name_or_listenerend# @return [Array<String>] names of available events to which we can subscribedefavailable_events__bus__.events.keysend
I believe that this behavior would prevent users from subscribing to non-registered events.
Moved from here: dry-rb/dry-monitor#11
Hey guys,
We use dry-monitor together with dry-events in karafka. In order to provide a "safe" API (safe in terms of typo mistakes etc) we've implemented two additional methods for the monitor that could be useful when working with it. Would it fit as a PR in this library?
I believe that this behavior would prevent users from subscribing to non-registered events.
Whole monitor can be found here: https://github.com/karafka/karafka/blob/master/lib/karafka/instrumentation/monitor.rb
The text was updated successfully, but these errors were encountered: