Marta Martínez
Marta Martínez

Reputation: 1

HTTPBuilder Retry strategy

I have the following method in my Rest requests handler

def get_Game(String gameId){
    def gameInfo
    http.request(Method.GET, ContentType.XML){
        uri.path = gamePath
        uri.query = [id : gameId]
        response.'200' = { resp, reader ->
            gameInfo =  reader.item
        }
        response.'202' = {
            println 'retry'
        }
    }
    return gameInfo
}

The response status for this request is 200 if data is retrieved or 202 when the request is queued and I need to keep retrying until the status is 200.

Is there anyway to retry a request while response code is 202?

Upvotes: 0

Views: 284

Answers (0)

Related Questions