Policy flow questions At Least One and All Assertions

Document ID : KB000100780
Last Modified Date : 13/06/2018
Show Technical Document Details
Introduction:
An unreliable backend server that responds intermittently with an error condition.
The idea is to repeat the request to the backend server if it fails.
When we say fail it means that the backend has an empty body as a response OR returns with a non 200 status code. 
How can I do this with Policy Logic?
 
Instructions:

If the body is totally empty Or http.responsecode is xxx 
I would probably do, 
AT Least One (folder) 
-->ALL (folder) 
--->HTTP Route (First route and do below validations or fail) 
--->At least one (or my may not need this. 
--->Compare Variable ${request.mainpart) is not empty 
--->Compare Variable http.responsexxx is 200 
HTTP Route (Again) 

Meaning 
Either ALL the http route and body is not empty or http.responsecode (Theoretically you can get rid of the at least one if you want both evaluated and want the body to not be empty and the httpreason of 200). 
If either of those 2 fail go back to the branch with the at least one and run a second http route. 


An At Least (logical OR) one says At least one of the assertions Underneath that branch Must equal TRUE. 
If the next branch as above is an ALL (Logical AND) for the ALL to be true everything must be true underneath this. 
Meaning the HTTP Route must come back as success. 
AND 
A Since the Next assertion is At least one under the ALL (OR) 

The compare variable for the response BODY or Status code must be true. As a side note processing is linear if the first item is true (The Response.mainpart) the rest is not evaluated. If either the body is null or the response code is not 200 then the whole branch does not equal true.
So the evaluation goes back to the main body of the First AT Least one. And does the route again which must not fail to continue processing.