Question

I have a rails app which needs to request data from a local running process running EventMachine. What is the best way of implementing this request/response?

Was it helpful?

Solution 5

Thanks for the answers. I ended up using RabbitMQ.

OTHER TIPS

Not sure about it, but I'd try to use sockets for it. EM - listen and recieve messages, return data, Rails - connect to EM and send a message and recieve data.

I don't know if this is the perfect answer, but I'm looking into the same problem and am going to try to use https://github.com/kwi/BrB.

Also, check out this blog post: http://www.tricksonrails.com/2010/04/introducing-brb-extremely-fast-interface-for-doing-distributed-ruby/

Also check a new gem: websocket-rails
offers plug and play websocket support for ruby on rails.

The simplest way is to have your backend talk HTTP. Your Rails app then just makes an HTTP request to your backend server. Return the data in JSON and use as needed in Rails.

At PostRank we created Goliath which we ran behind HAProxy to surface data for our Rails apps.

Take a look at IO.pipe if you're under *nix system and you are performing a fork for EM.run loop.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top