Skip to content

Commit 7360bb0

Browse files
committed
retry check fix
1 parent 3c2c610 commit 7360bb0

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ You do not need to download and build the source to use the SDK but if you want
8080
- `maxKeepAliveTimeMs` maximum amount of time in milliseconds that a connection can be idle before it is evicted from the pool. default value is 30000
8181
- `allowRetry` config parameter will only work for HttpClient and PoolingHttpClient. Set `allowRetry` config parameter to "true" to enable retry mechanism and set merchant specific values for the retry.
8282
- Set integer values and long values for config parameter `numberOfRetries` *and* `retryInterval` respectively. Retry Interval is time delay for next retry in milliSeconds.
83-
- Number of retry parameter should be set between 1 to 3. Any other value will throw an Error Message.
83+
- Number of retry parameter should be set between 1 to 5. Any other value will throw an Error Message.
8484
- Refer to the [Retry Pattern](README.md#retry-pattern) section below.
8585
- Please refer to the accompanying documentation for the other optional properties that you may wish to specify.
8686
- Set customHttpClassEnabled to true to make use of Custom Http Library.
@@ -193,7 +193,7 @@ CyberSource supports Message Level Encryption (MLE) for Simple Order API. Messag
193193

194194
Retry Pattern allows to retry sending a failed request and it will only work with `useHttpClient=true` or `useHttpClientWithConnectionPool. `allowRetry` flag enables the retry mechanism.
195195
- Set the value of `allowRetry` parameter to "TRUE/FALSE". Then the system will retry the failed request as many times as configured by the merchant in the config parameter 'numberOfRetries'.
196-
- numberOfRetries parameter value should be set between 0 to 3. By default the value for numberOfRetries will be 3. User can set a delay in between the retry attempts.
196+
- numberOfRetries parameter value should be set between 0 to 5. By default the value for numberOfRetries will be 3. User can set a delay in between the retry attempts.
197197
- Config parameter for this property is 'retryInterval' in `cybs.property` file. The default value for 'retryInterval' parameter is 1000 which means a delay of 1000 milliSeconds.
198198

199199
## Third Party jars

java/src/main/java/com/cybersource/ws/client/MerchantConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ public MerchantConfig(Properties _props, String _merchantID)
621621
numberOfRetries = getIntegerProperty(merchantID, "numberOfRetries", 3);
622622
if (numberOfRetries > 0)
623623
retryInterval = getIntegerProperty(merchantID, "retryInterval", 1000);
624-
if (numberOfRetries < 1 || numberOfRetries > 3 || retryInterval < 0) {
624+
if (numberOfRetries < 1 || numberOfRetries > 5 || retryInterval < 0) {
625625
throw new ConfigException("Invalid value of numberOfRetries and/or retryInterval");
626626
}
627627
}
@@ -790,7 +790,7 @@ public String getLogString() {
790790
appendPair(sb, "useHttpClientWithConnectionPool", useHttpClientWithConnectionPool);
791791
appendPair(sb, "enableJdkCert", enableJdkCert);
792792
appendPair(sb, "enableCacert", enableCacert);
793-
if(useHttpClient){
793+
if(useHttpClient || useHttpClientWithConnectionPool){
794794
appendPair(sb, "allowRetry", allowRetry);
795795
appendPair(sb, "RetryCount", numberOfRetries);
796796
appendPair(sb, "RetryInterval", retryInterval);

java/src/main/java/com/cybersource/ws/client/PoolingHttpClientConnection.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,12 @@ protected void initHttpClient(MerchantConfig merchantConfig, PoolingHttpClientCo
115115

116116
HttpClientBuilder httpClientBuilder = HttpClients.custom()
117117
.setKeepAliveStrategy(DefaultConnectionKeepAliveStrategy.INSTANCE)
118-
.setRetryHandler(new CustomRetryHandler())
119118
.setConnectionManager(poolingHttpClientConnManager);
120119

120+
if(merchantConfig.isAllowRetry()){
121+
httpClientBuilder.setRetryHandler(new CustomRetryHandler());
122+
}
123+
121124
setProxy(httpClientBuilder, requestConfigBuilder, merchantConfig);
122125

123126
httpClient = httpClientBuilder

zip/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Retry Pattern Allows to retry sending a failed request and it will only work wit
206206
set the value of allowRetry parameter to "TRUE/FALSE". Then the system will retry the failed request as many times as configured by the merchant
207207
in the config parameter 'numberOfRetries'.
208208

209-
numberOfRetries parameter value should be set between 0 to 3. By default the value for numberOfRetries will be 3. User can set a delay in between the retry attempts.
209+
numberOfRetries parameter value should be set between 0 to 5. By default the value for numberOfRetries will be 3. User can set a delay in between the retry attempts.
210210
Config parameter for this property is 'retryInterval' in cybs.property file. The default value for 'retryInterval' parameter is 1000 which means a delay of 1000 milliSeconds.
211211

212212
##Third Party jars

0 commit comments

Comments
 (0)