Should I Solve this with Multithreading in Ruby?
Posted
by viatropos
on Stack Overflow
See other posts from Stack Overflow
or by viatropos
Published on 2010-04-28T01:45:57Z
Indexed on
2010/04/28
1:53 UTC
Read the original article
Hit count: 296
I have a strange case, here's the sequence of actions:
- User edits a document and hits save
- Application sends GET request to service
- Service sends POST request back to application in the middle of responding to the GET request
- Application, in the same state as when it made the GET request, responds to the POST request (sends document data) to service.
- Service sends data back to Application (responding to original GET request)
- Application handles the rest...
The use case is this: I was thinking how can I make Yahoo Pipes POST data? Specifically, I want it to be able to update Google Docs when a user makes a change locally (on a custom editor).
So user edits doc, makes GET request to Yahoo Pipes, Pipes makes a POST request back to App to get the document (Pipes can only make this type of POST request), App sends doc, Pipes formats data according to the Google API, Pipes responds to GET request with Google API formatted XML, App makes the post request.
Theoretically, how would I accomplish this?
It seems that I need to create a separate ruby Process for the GET request, and when Pipes sends the POST request, I find that process and send its output, then I'm stuck. This would cut out the need for a database for this particular case (I could save the stuff temporarily in a database, but that doesn't seem right).
Any ideas?
This would make it so I don't have to format things to the Google API in ruby, I could leave that to Pipes.
© Stack Overflow or respective owner