xml-rpc server with long-run methods

P

Pavel Arno¹t

hi,

please let me explain my idea of simple ruby-based backup system:)

on each node runs XML-RPC server; these nodes recieve commands from master server;

for example, node recieves:
Backup.run("rsync", "/etc", "backup.clnet.cz")
answers:
"code => "100", "description" => "command queued"
does backup (long-run process) and informs administrator (via email, or xml-rpc call to master server)

the problem is that i don't know how to implement this with xml-rpc ruby implementation; only way how to send answer to xml-rpc client is "return" in xml-rpc handler

so a little recap:) i want to receive command, answer to client and do something after it (and NOT receive command, do something and answer to client after it)

-------------------------------------------------------
require "xmlrpc/server"

server = XMLRPC::CGIServer.new
server.set_parser(XMLRPC::XMLParser::REXMLStreamParser.new)

class BackupHandler

def run(method, path, destination)

return "code" => "100", "description" => "command queued"

"backup stuff"

"xml-rpc call to master server"

end

end

server.add_handler("Backup", BackupHandler.new)
server.serve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,792
Messages
2,569,639
Members
45,353
Latest member
RogerDoger

Latest Threads

Top