Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5976763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:16:28+00:00 2026-05-22T21:16:28+00:00

I have a Rails project and two ruby mini-daemons running in the background. What’s

  • 0

I have a Rails project and two ruby mini-daemons running in the background. What’s the best way to communicate between them?

Communication like below should be possible:
Rails -> Process 1 -> Process 2 -> Rails

Some requests would be sync, other async.

Queues (something like AMQ, or custom Redis based) or RPC HTTP calls?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:16:29+00:00Added an answer on May 22, 2026 at 9:16 pm

    I implemented a system via RabbitMq + the bunny gem.

    Update:

    After reading http://blog.brightbox.co.uk/posts/queues-and-callbacks I decided to try out RabbitMQ. There are two gems amqp (async, eventmachine based) or bunny (sync). amqp is great, but if you’re using Rails with passenger it can do some weird things.

    The system works like this, the daemons listen on a queue for messages:

    # The incoming data should be a JSON encoded hash that looks like:
    # { "method" => method_to_call, "opts" => [ Array of opts for method ],
    #   "output" => "a queue where to send the result (optional)" }
    # If output is specified it will publish the JSON encoded response there.
    def listen_on(queue_name, class)
      BUNNY.start
      bunny = BUNNY.queue(queue_name)
    
      bunny.subscribe do |msg|
        msg = JSON.parse(msg[:payload])
    
        result = class.new.send(msg["method"], *msg["opts"])
    
        if msg["output"]
          BUNNY.queue(msg["output"]).publish(result.to_json)
        end
      end
    

    So once a message is received it calls a method from a class. One thing to note is that it would have been ideal to use bunny for Rails and amqp in the daemons. But I like to use one gem pe service.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is not a ruby/rails project deploy. I have the following situation and I
I am building a ruby on rails project. it is a portal. I have
I have an existing project written in Ruby on Rails. It is sort of
I have two Ruby on Rails projects on my computer. For some reason, when
I have a Ruby on Rails application that has two active environments, Stage and
In a rails project I have two entities, Users and Institutions, they have a
I'm using MetaSearch gem in my Rails 3 project. I have two models: class
I have two tables in my rails application Categories and Projects. The relationship between
I'm a novice in ruby-on-rails. I have an applications counting distance between metro station
I'm joined a rails project which have been going for past two months. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.