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 8425021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:09:45+00:00 2026-06-10T04:09:45+00:00

I am designing a Rails app that takes in requests, uses data within the

  • 0

I am designing a Rails app that takes in requests, uses data within the request to call a 3rd party web service, process the reply and then sends out a response to the original requestor and also issues a PUT request to yet another service.

I am trying to wrap my head around how to design this Rails app as it’s different from the canonical Rails structure.

The objects are Lists and Tasks. Each List has many Tasks, and each Task belongs to a List.

The request I would get is something like:

http://myrailsapp.heroku.com/v1/lists?id=1&from=2012-02-12&to=2012-02-14&priority=high

In this example I am requesting tasks from 2/12/2012 to 2/14/2012 with a high priority in List #1

I would then issue a 3rd party web service call like this:

http://thirdpartywebservice.com/v1/lists?id=4128&from=2012-02-12&to=2012-02-14&priority=high
As you can see some processing was done on the data (id was changed in this case)

The results are then sent back to the requestor and to another web service via PUT.

My question is, how do I set up the Rails app to handle these types of behaviors? How does the controller structure change? This looks like a good use case for queues, how do I distribute multiple concurrent requests among queues?

For one thing I don’t need data persistence (data can be discarded after the response is sent out) and also data structure design is simplified. (I don’t think I need ruby objects, simply dictionaries or hashes representing these would be lighter weight and quicker to implement)

Edit

So I broke down the work flow of the app into these components

  • Parse incoming request
  • Construct 3rd part web service request
  • Send 3rd party request
  • Enqueue a worker to process the expected response
  • Process the response once it arrives
  • Send the parsed result back as a response

Which of the standard ruby controllers handle each of these steps? What are the models needed besides Lists and Tasks?

  • 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-06-10T04:09:47+00:00Added an answer on June 10, 2026 at 4:09 am

    You should still use a database because passing data to Resque is messy. Rather, you should store it in the database and then pass the id to the workers, fetch the data, commit any new data or delete the record. It’s really up to you but this method is cleaner. You can also use a push service like faye to let the user know when the processing is complete.

    If you expect to have many concurrent requests, I would recommend Sidekiq as it’s less of a memory hog. Having 4-5 resque workers can already suck up about 512 MB. The controller structure should not change. Please comment on anything you need clarified and I’ll be happy to update my answer.

    EDIT

    You would want to use a separate database store, such as Postgres. Not sure if it’s important what models you need, but essentially this is what should be happening.

    1. In your controller, create a Request object which contains the query params you want to query this 3rd party service with. Then enqueue a job to be handled by Sidekiq/Resque, let’s call this ThirdPartyRequest and pass in the id of the Request object you just created as an argument. Then render a view here showing the Request object. Let’s say that Request#response is still empty cause it hasn’t been processed yet, so let the user know it’s still processing.
    2. A worker then handles your job ThirdPartyRequest. ThirdPartyRequest should then fetch the Request object and obtain the query params needed to contact the third party service. It does that then gets a Request. Update the Request object with this Request then save it.

      class ThirdPartyRequest
        def self.perform(request_id)
          request = Request.find(request_id)
      
          # contact third party service
      
          request.response = ...
          request.save
        end
      end
      
    3. The user can continually refresh his page to check on his/her Request object. Once it gets updated with the response, they will know its completed. If you want the page to refresh automatically, look into faye/juggernaut/private_pub or a SaaS solution like Pusher.

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

Sidebar

Related Questions

I'm current designing a Rails application that uses a form for user login, then
Background I'm designing a Rails app to record research data. Most of it can
I have some data that I want to store somewhere in my Rails app
I'm new to rails and I'm currently using 2.3.8. I'm designing a web service
I have a new app (Rails 2.3.8) that uses lots of money fields. I'm
We are designing an application that will use Rails and Wordpress to interact with
The rails docs are apparently in error - http://guides.rubyonrails.org/association_basics.html#selfjoins ) In designing a data
I'm designing a ruby on rails app for a pharmacy, and one of the
I am building a rails app that has a number of models, one of
I'm using a select field in a Rails app that is NOT tied to

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.