|
|
|
@@ -59,12 +59,13 @@ import altk.comm.engine.Broadcast.PostbackThreadActionOnEmpty; |
|
|
|
*/ |
|
|
|
public class Postback |
|
|
|
{ |
|
|
|
private static final String XML_VERSION_1_0_ENCODING_UTF_8 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; |
|
|
|
private static final String XML_VERSION_1_0_ENCODING_UTF_8 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; |
|
|
|
|
|
|
|
private static final int QUEUE_WAIT = 300; // seconds |
|
|
|
private static final int POSTBACK_SERVER_WAIT_TIME = 10; // seconds |
|
|
|
|
|
|
|
private static final int RETRIES_DEFAULT = 3; |
|
|
|
private static final int RETRIES_DEFAULT = 5; |
|
|
|
private static final int RETRY_SLEEP_SECONDS = 5; |
|
|
|
|
|
|
|
private final String postBackURL; |
|
|
|
private final String xmlTopElement; |
|
|
|
@@ -134,6 +135,8 @@ public class Postback |
|
|
|
switch (post(reportList)) |
|
|
|
{ |
|
|
|
case IRRECOVERABLE_ERROR: |
|
|
|
// YML: should abort broadcfast to contain damage. |
|
|
|
break; |
|
|
|
case SUCCESS: |
|
|
|
break; |
|
|
|
|
|
|
|
@@ -349,6 +352,17 @@ public class Postback |
|
|
|
HttpContext context) |
|
|
|
{ |
|
|
|
if (executionCount >= maxRetries) return false; |
|
|
|
if (executionCount > 1) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
Thread.sleep(RETRY_SLEEP_SECONDS * 1000); |
|
|
|
} |
|
|
|
catch (InterruptedException ex) |
|
|
|
{ |
|
|
|
// ignore |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
}; |
|
|
|
|