1

I'm thinking about my options here.

  • implement it with after_create/after_update hooks in activerecord with models.
  • using ActiveSupport::Notifications to decouple activity feed objects with models.
  • use observer.

I wasn't able to find much information about the second approach. And I imagine the third one is kinda like the first one. Am I using ActiveSupport::Notifications wrong? Why?

randomor
  • 5,329
  • 4
  • 46
  • 68
  • Are you needing to broadcast the activity feed to multiple users? – wurde Mar 20 '14 at 00:07
  • @wurde No. It's a communal feed, all user's activities will be shared. – randomor Mar 20 '14 at 00:20
  • Ok. I'm not that familiar with ActiveSupport::Notifications either, perhaps you could store your activities in ActiveRecord and a cache of recent activities client-side. – wurde Mar 20 '14 at 00:23
  • @wurde, thanks for looking into it anyways. I'm guessing not many people is taking the second route for some reason. Even with fan-out-on-write feeds, ActiveSupport::Notification support a queue natively, which makes it even more interesting option and makes me more curious. – randomor Mar 20 '14 at 01:07
  • 1
    @randomor I have always felt more confident with decoupled systems. The article you mentioned in the answer just presents some use cases, every one has different needs and goals. I think you should go with the second route, nonetheless. – rubish Apr 04 '14 at 10:12

1 Answers1

1

Found this post about using ActiveSupport::Notification to implement email notifications. It might be similar with activity streams.

http://alma-connect.github.io/techblog/2014/03/rails-pub-sub.html

randomor
  • 5,329
  • 4
  • 46
  • 68
  • Nice read. Thanks for the URL. I like that it includes some use cases for ActiveSupport::Notifications coupled with background jobs. – scarver2 May 23 '14 at 13:14