soveran / disque-rb

Disque client for Ruby
MIT License
68 stars 4 forks source link

Rails integration #1

Open peteb opened 9 years ago

peteb commented 9 years ago

Are there any ideas for an integration with Rails? Maybe it's not so useful as people will mostly use Disque for sending out messages from Rails to non-Rails processes?

I'm also thinking about a serialization layer so you can send and receive plain Ruby objects. Do you think that'd be a good fit for this project?

soveran commented 9 years ago

Hey @peteb, indeed any gem that provides Rails integration for Disque can be useful for a lot of people. I think the way to do it is to create an adapter for ActiveJob, you can see an example adapter for Resque here. That adapter would require disque-rb for all the low level communication. What do you think about that?

peteb commented 9 years ago

Yes I had a look at ActiveJob but it seems adapters are pretty slim, mostly just a mapping layer rather than any logic. Running threads, routing messages to the correct #perform, etc. is done in another library, for example Sidekiq. So something like that'd have to be implemented.

DevinRiley commented 9 years ago

@peteb I've been toiling away at a project to do the threading/worker code side of things over at https://github.com/DevinRiley/disque_jockey. It uses this project (disque-rb) to communicate with disque but adds concurrency and worker classes similar to projects like Resque or Sidekiq.

Here's a section of the README on integrating with Rails: https://github.com/DevinRiley/disque_jockey#using-disquejockey-with-rails

Cheers

mzemel commented 9 years ago

@peteb I tried playing around with Disc. Might be something worth looking at, but I could not get it running immediately.

elcuervo commented 9 years ago

@mzemel what issues did you encounter?

mzemel commented 9 years ago

The good folks at Disc put out v0.0.21 which fixes the problem I was having. See discussion here