From: Luke Kanies Date: 2005-05-21T02:12:28+09:00 Subject: Web services and Ruby Hi all, I'm in the process of writing a kind of distributed application, where one or more central servers does some initial processing of a set of files, and a bunch of clients then connect and get an appropriate subset of the processed information. In addition, each of the clients needs to be queryable, so I can always figure out their status and get metrics and such. Obviously there are many ways to do this, but given the industry I'm targeting with this and the applications with which I expect to need to integrate, it seems like some kind of semi-standardized web service makes the most sense. So, using some examples online, I hacked up a quick webrick/soap4r server on both my client and server, and I'm successfully passing information around. Well, kind of. The problem is that webrick seems to require that my process be entirely reactive -- both my client and server want to sit there waiting for someone to connect, when obviously that won't work. I need to get separate actions going on each process, but webrick seems to want to require that all action is entirely reactive. So, I'm now in the situation where the server works entirely reactively, and the client can contact it fine before I start the client's webrick server, but after the server starts I lose control of the process. What I'm really looking for is something like Perl's POE: Something that allows me to set up multiple sub-processes, none of which are blocking, and all of which run based on callbacks. On the server side, I want to respond to requests, and periodically reprocess files as necessary (as they change or whatever). On the client side, I want to periodically connect to the server and get new data, and the data I have all has a period on which it is reassessed -- e.g., every hour verify X is still true. The client needs to also respond to requests for metrics and such when they come in. I've been considering setting up the server as a Rails server, although that is certainly overkill at this point in the game and might be overkill in the long term. I think that's too heavyweight for the client, though, and I'm not sure I would get the features I want out of Rails anyway. Can anyone recommend anything I can use to get this kind of behaviour? Are threads the only answer? (Please say they aren't.) -- Due to circumstances beyond your control, you are master of your fate and captain of your soul. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://config.sage.org