# Xml-rpc server with long-run methods

**URL:** <https://rubytalk.org/t/xml-rpc-server-with-long-run-methods/9403>\
**Category:** ruby-talk\
**Created:** [19 December 2003 10:44 UTC](https://rubytalk.org/t/xml-rpc-server-with-long-run-methods/9403 "2003-12-19T10:44:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavel\_Arnost](https://avatars.discourse-cdn.com/v4/letter/p/d9b06d/32.png) [@Pavel\_Arnost](https://rubytalk.org/u/Pavel_Arnost)\
**Post date:** [19 December 2003 10:44 UTC](https://rubytalk.org/t/xml-rpc-server-with-long-run-methods/9403/1 "2003-12-19T10:44:05Z")

</div>

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](http://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
> 
> regards,  
> pavel
