DEV Community

loading...

Discussion on: Intuitive Ruby Event Router

Collapse
ahmadelassuty profile image
Ahmad Elassuty Author

Thanks! 🙏

There is not at the moment. Would be great if you explain for what use-case a global listener is needed, and we can drive an API for it 🙂

Collapse
kinnalru profile image
Samoilenko Yuri

It's very useful (and important) to be able to subscribe to all event especially with filtering. It can be used for debugging or logging particular events.
Github ex: log all events(any kind) for specific user, or catch all notifications for particular PullRequest

Thread Thread
ahmadelassuty profile image
Ahmad Elassuty Author

It makes sense to have better support for debugging and logging for sure, but not necessary through global listeners that has filtering functionality, as the filtering can happen as part of the destination handlers (business logic).

Generally, I see the value of having global listeners, but what I'm not sure of is creating global destinations that subscribe to Event instead of Event routing to destinations as adopted by the current API. That will require adopting two completely different APIs. Also as you mentioned, there is already gems doing so, not sure if there is any gem that is backed with a storage system, e.g Redis/Rabbitmq like EventRouter. What do you think?

Collapse
kinnalru profile image
Samoilenko Yuri

Often publish/subsribe systems like ActiveSupport::Instrumentation or whisper gem using string event identifier. So it is very simple to implement global subscription and filtering with regexp matchers or something else.