DEV Community

Discussion on: How to implement Pub/Sub pattern in Ruby on Rails?

Collapse
 
yerassyl_diyas_3608a94d4a profile image
Yerassyl Diyas

Thanks for the cool tutorial. I have a question regarding asynchronous part. So when i publish an event, subscriber is called inside the same thread? Or will it spawn new thread somehow. Ie how async part is achieved?

Collapse
 
vladhilko profile image
Vlad Hilko

As I understand it, ActiveSupport::Notifications and dry-events do not have async capabilities and are fully synchronous. Nevertheless, it seems that wisper can handle events asynchronously based on the information on its GitHub page (github.com/krisleech/wisper#handli...), although I haven't had the chance to try it myself. In our project we use ActiveSupport::Notifications, and to deal with the lack of async support, we run separate async jobs from the subscription.