Skip to content

Commit 14202f0

Browse files
committed
sync
2 parents 17f061d + ec956a1 commit 14202f0

37 files changed

Lines changed: 978 additions & 867 deletions

README.md

Lines changed: 57 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,45 @@ You do not need to download and build the source to use the SDK but if you want
5959
- Set `sendToAkamai` config parameter with toggle value "true/false" to turn on/off routing requests through Akamai to Cybersource. By default, it is set to true.
6060
- `serverURL` config parameter will take precedence over `sendToProduction` and `sendToAkamai` config parameters. By default the `serverURL` configuration is commented out.
6161
- If `enableJdkcert` parameter is set to true, certificates will be read from the JKS file specified at keysDirectory location. The JKS file should be of the same name as specified in keyFilename.
62-
- To know how to convert p12 to JKS refer the JKS creation section of this document.
63-
- If 'enableCacert' property parameter is set to true, certificates will be read from the cacerts file specified at keysDirectory location.If keysDirectory path is not set,certificate will be loaded from Java Installation cacerts file. The cacerts file should be of the same name as specified in keyFilename.
62+
- To know how to convert p12 to JKS refer the JKS creation section of this document.
63+
- If 'enableCacert' property parameter is set to true, certificates will be read from the cacerts file specified at keysDirectory location.
64+
- If keysDirectory path is not set,certificate will be loaded from Java Installation cacerts file. The cacerts file should be of the same name as specified in keyFilename.
6465
- If `certificateCacheEnabled` parameter is set to false (default is true), the p12 certificate of a merchant will be reloaded from filesystem every time a transaction is made
6566
- If `useHttpClient` parameter is set to true (default is false), then simple HttpClientConnection will be enabled
66-
- If `useHttpClientWithConnectionPool` parameter is set to true (default is false), then poolingHttpClientConnection will be enabled
67-
- In case of poolingHttpConnection, we are initializing connection manager and httpclient once, If any change in value in between the application is running, it will not reflect. need to restart it.
68-
- Refer to the [PoolingHttpClient Shutdown](README.md#poolinghttpclientshutdown) section below.
69-
- If`enabledShutdownHook` is true (default is true), enables JVM runtime shutdown hook and execute our shutdown api. This is applicable only when useHttpClientWithConnectionPool is true.
67+
- If `useHttpClientWithConnectionPool` parameter is set to true (default is false), then poolingHttpClientConnection will be enabled. In case of poolingHttpConnection,
68+
we are initializing connection manager and httpclient once, If any change in value in between the application is running, it will not reflect. need to restart it.
7069
- Below properties are specific to poolinghttpclient connection, If it is not added in properties file, it will throw config exception.
71-
Note : Below default values used in properties files are based on our testing application factors such as TPS, CPU, JVM, OS etc
72-
Before using these values in actual real time application, please consider all real time factors. Refer this link for more detailed explanation.
73-
- `maxConnections` set the maximum number of total open connections. default value is 200
74-
- `defaultMaxConnectionsPerRoute` Set the maximum number of concurrent connections per route. default value is 200
75-
- `maxConnectionsPerRoute` Set the total number of concurrent connections to a specific route. default value is 200
76-
- `connectionRequestTimeoutMs` the time to wait for a connection from the connection manager/pool. default value is 1000
77-
- `connectionTimeoutMs` the time to establish the connection with the remote host. default value is 2000
78-
- `socketTimeoutMs` the time waiting for data – after establishing the connection; maximum time of inactivity between two data packets. default value is 2000
79-
- `evictThreadSleepTimeMs` amount of time in milliseconds between sweeps by the idle connection evictor thread. default value is 3000
80-
- `maxKeepAliveTimeMs` maximum amount of time in milliseconds that a connection can be idle before it is evicted from the pool. default value is 30000
81-
- `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.
82-
- 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 5. Any other value will throw an Error Message.
70+
71+
Note : Sample values used in properties files are based on our testing application factors such as TPS, CPU, JVM, OS etc.
72+
Before using these values in actual real time application, please consider all real time factors.
73+
- `maxConnections` Specifies the maximum number of concurrent, active HTTP connections allowed by the resource instance to be opened with the target service.
74+
There is no default value. For applications that create many long-lived connections, increase the value of this parameter.
75+
- `defaultMaxConnectionsPerRoute` the maximum number of connections per (any) route.
76+
- `maxConnectionsPerRoute` Specifies the maximum number of concurrent, active HTTP connections allowed by the resource instance to the same host or route.
77+
In SDK, all above config does same functionality and the same value can be given to these configs as we have only one route.
78+
79+
Note: This number cannot be greater than Maximum Total Connections and every connection created here also counts into Maximum Total Connections.
80+
- `connectionRequestTimeoutMs` Time taken in milliseconds to get connection request from the pool. If it times out, it will throw error as Timeout waiting for connection from pool
81+
- `connectionTimeoutMs` Specifies the number of milliseconds to wait while a connection is being established.
82+
- `socketTimeoutMs` Specifies the time waiting for data – after establishing the connection; maximum time of inactivity between two data packets.
83+
- `evictThreadSleepTimeMs` Specifies time duration in milliseconds between "sweeps" by the "idle connection" evictor thread.
84+
This thread will check if any idle/expired/stale connections are available in pool and evict it.
85+
- `maxKeepAliveTimeMs` Specifies the time duration in milliseconds that a connection can be idle before it is evicted from the pool.
86+
- `staleConnectionCheckEnabled` It determines whether the stale connection check is to be used. Disabling the stale connection check can result in slight performance improvement
87+
at the risk of getting an I/O error, when executing a request over a connection that has been closed at the server side. By default it is set to true, which means it is enabled.
88+
- `validateAfterInactivityMs` By default it is set to 0. This value can be set if in case you decide to disable staleConnectionCheckEnabled to get slight better performance.
89+
We recommended a value of 2000ms.
90+
- `enabledShutdownHook` We should close the connection manager, http client and idle connection cleaner thread when application get shutdown both abruptly and gracefully.
91+
If `enabledShutdownHook` is true, then JVM runtime addShutdownHook method will be initialized. Shutdown Hooks are a special construct that allows developers to plug in a piece of
92+
code to be executed when the JVM is shutting down. This comes in handy in cases where we need to do special clean-up operations in case the VM is shutting down.
93+
` private void addShutdownHook() {
94+
Runtime.getRuntime().addShutdownHook(this.createShutdownHookThread());
95+
}`
96+
createShutdownHookThread method will call static shutdown api to close connectionManager, httpClient and IdleCleanerThread. By default this is enabled when useHttpClientWithConnectionPool is true.
97+
- `allowRetry` config parameter will only work for HttpClient and PoolingHttpClient.
98+
Set `allowRetry` config parameter to "true" to enable retry mechanism and set merchant specific values for the retry.
99+
- Set integer values and long values for config parameter `numberOfRetries` *and* `retryInterval` respectively. Retry Interval is time delay for next retry in milliSeconds.
100+
- Number of retry parameter should be set between 1 to 5. By default the value for numberOfRetries will be 3. Any other value will throw an Error Message.
84101
- Refer to the [Retry Pattern](README.md#retry-pattern) section below.
85102
- Please refer to the accompanying documentation for the other optional properties that you may wish to specify.
86103
- Set customHttpClassEnabled to true to make use of Custom Http Library.
@@ -157,7 +174,13 @@ keytool -list -v -keystore <Your_keystore_name>`
157174
- Second entry should be for `CyberSource_SJC_US` certificate with alias name as CyberSource_SJC_US
158175

159176
## PoolingHttpClient
160-
To get more information please refer wiki.
177+
PoolingHttpClient is built using the apache's PoolingHttpClientConnectionManager class. It comes with retry functionality which is very much needed in case if
178+
SDK receives an I/O error/exception, when executing a request over a connection that has been closed at the server side. However there might be some cases when
179+
transaction has reached server and similar or some other exception has occurred. We are considering `merchantTransactionIdentifier` as idempotent key, specially
180+
in case of auth service(`ccAuthService`). Hence if you want to use PoolingHttpClient, for auth service(`ccAuthService`) merchantTransactionIdentifier field is
181+
mandatory in the payload for both nvp and xml. The value of the merchant transaction ID must be unique for 60 days.
182+
183+
To get more information related to connection pooling please refer wiki.
161184

162185
## Message Level Encryption
163186
CyberSource supports Message Level Encryption (MLE) for Simple Order API. Message level encryption conforms to the SOAP Security 1.0 specification published by the OASIS standards group.
@@ -206,17 +229,19 @@ Retry Pattern allows to retry sending a failed request and it will only work wit
206229

207230
## Changes
208231

209-
Version Cybersource-sdk-java 6.2.10 (APR,2020)
232+
Version Cybersource-sdk-java 6.2.10 (MAY,2020)
210233
_______________________________
211234

212-
1)MerchantConfig Object Caching based on KeyAlias/Merchant Id
235+
1)Added PoolingHttpClientConnection implementation
213236

214-
2)Added PoolingHttpClientConnection implementation
237+
2)MerchantConfig Object Caching based on KeyAlias/Merchant Id
215238

216239
3)Changed retry interval from second to millisecond
217240

218-
4)Added one more request header "v-c-client-computetime" to calculate time taken to send request to cybersource
219-
241+
4)Added one more request header "v-c-client-computetime" to calculate time taken to send request to Cybersource
242+
243+
5)Added troubleshooting section in README.
244+
220245
Version Cybersource-sdk-java 6.2.9 (APR,2020)
221246
_______________________________
222247
1)Corrected request header name
@@ -310,10 +335,14 @@ _______________________________
310335
Client.runTransaction(requestMap, merchantProperties);
311336
}catch (ClientException e){
312337
e.getInnerException().printStackTrace();
338+
// or
339+
String stackTrace = Utility.getStackTrace(e.getInnerException() != null? e.getInnerException(): e);
313340
}
314-
341+
342+
343+
315344
## Documentation
316-
- For more information about CyberSource services, see <http://www.cybersource.com/developers/documentation>.
317-
- For all other support needs, see <http://www.cybersource.com/support>.
345+
- For more information about CyberSource services, see <https://www.cybersource.com/en-us/support/technical-documentation.html>.
346+
- For all other support needs, see <https://support.cybersource.com/>.
318347

319348

java/pom.xml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,21 @@
8787
</executions>
8888
</plugin>
8989
<plugin>
90+
<groupId>org.apache.maven.plugins</groupId>
9091
<artifactId>maven-javadoc-plugin</artifactId>
91-
<version>2.10.1</version>
92+
<version>3.2.0</version>
9293
<executions>
9394
<execution>
9495
<id>attach-javadocs</id>
9596
<phase>package</phase>
9697
<goals><goal>jar</goal></goals>
9798
</execution>
9899
</executions>
100+
<configuration>
101+
<additionalOptions>
102+
<additionalOption>-Xdoclint:none</additionalOption>
103+
</additionalOptions>
104+
</configuration>
99105
</plugin>
100106
<plugin>
101107
<artifactId>maven-jar-plugin</artifactId>
@@ -139,6 +145,20 @@
139145
<target>1.6</target>
140146
</configuration>
141147
</plugin>
148+
<plugin>
149+
<groupId>org.apache.maven.plugins</groupId>
150+
<artifactId>maven-surefire-plugin</artifactId>
151+
<version>2.4.3</version>
152+
<configuration>
153+
<argLine>-Dfile.encoding=ISO-8859-1</argLine>
154+
<includes>
155+
<include>**/*Test.java</include>
156+
</includes>
157+
<excludes>
158+
<exclude>**/*SystemTest.java</exclude>
159+
</excludes>
160+
</configuration>
161+
</plugin>
142162
<plugin>
143163
<groupId>org.codehaus.mojo</groupId>
144164
<artifactId>exec-maven-plugin</artifactId>
@@ -227,7 +247,7 @@
227247
<artifactId>opensaml</artifactId>
228248
</exclusion>
229249
</exclusions>
230-
</dependency>
250+
</dependency>
231251
<dependency>
232252
<groupId>org.apache.commons</groupId>
233253
<artifactId>commons-lang3</artifactId>

0 commit comments

Comments
 (0)