Hi there
I'm developing a small application which posts XML to some webservice. This is done using Net::HTTP::Post::Post. However, the service provider recommends using a re-connect.
Something like: 1st request fails -> try again after 2 seconds 2nd request fails -> try again after 5 seconds 3rd request fails -> try again after 10 seconds ...
What would be a good approach to do that? Simply running the following piece of code in a loop, catching the exception and run it again after an amount of time? Or is there any other clever way to do that? Maybe the Net package even has some built in functionality that I'm not aware of?
url = URI.parse("http://some.host")
request = Net::HTTP::Post.new(url.path)
request.body = xml
request.content_type = "text/xml"
#run this line in a loop??
response = Net::HTTP.start(url.host, url.port) {|http| http.request(request)}
Thanks very much, always appreciate your support.
Matt