disque-rb icon indicating copy to clipboard operation
disque-rb copied to clipboard

Rails integration

Open peteb opened this issue 10 years ago • 6 comments
trafficstars

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?

peteb avatar May 05 '15 15:05 peteb

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?

soveran avatar May 05 '15 16:05 soveran

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.

peteb avatar May 06 '15 08:05 peteb

@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

DevinRiley avatar Jun 27 '15 19:06 DevinRiley

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

mzemel avatar Aug 04 '15 22:08 mzemel

@mzemel what issues did you encounter?

elcuervo avatar Aug 05 '15 20:08 elcuervo

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

mzemel avatar Aug 05 '15 23:08 mzemel