You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -59,18 +59,53 @@ You do not need to download and build the source to use the SDK but if you want
59
59
- 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.
60
60
-`serverURL` config parameter will take precedence over `sendToProduction` and `sendToAkamai` config parameters. By default the `serverURL` configuration is commented out.
61
61
- 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.
64
65
- 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
65
-
-`allowRetry` config parameter will only work for HttpClient. Set `allowRetry` config parameter to "true" to enable retry mechanism and set merchant specific values for the retry.
66
-
- Set integer values for config parameter `numberOfRetries`*and*`retryInterval`. Retry Interval is time delay for next retry in seconds.
67
-
- Number of retry parameter should be set between 1 to 5. Any other value will throw an Error Message.
66
+
- If `useHttpClient` parameter is set to true (default is false), then simple HttpClientConnection will be enabled
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.
69
+
- Below properties are specific to poolinghttpclient connection, If it is not added in properties file, it will throw config exception.
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.
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.
68
101
- Refer to the [Retry Pattern](README.md#retry-pattern) section below.
69
102
- Please refer to the accompanying documentation for the other optional properties that you may wish to specify.
70
103
- Set customHttpClassEnabled to true to make use of Custom Http Library.
71
104
- Enter the custom class name in customHttpClass field. Provide the full package name along with the class name.
72
105
example customHttpClass= <packagename.customHttpClass>
73
106
- The custom HTTP Class must have a three argument constructor which accepts MerchantConfig, DocumentBuilder and LoggerWrapper as argument. Then it should call the constructor of the parent class.
107
+
-`merchantConfigCacheEnabled` If this property is set to true (default value is false) it will cache the merchantConfig object based on keyAlias/merchantID
108
+
-If cache enabled is true, for single merchant id, if you change any properties after first initialization, it will not reflect.
74
109
- Build this project using Maven.
75
110
-`mvn clean` - Cleans the Project
76
111
-`mvn install` - Builds the project and creates a jar file of client SDK. Includes running all unit tests and integration tests
- The first entry should contain a chain of two certificates - `CyberSourceCertAuth` and <Merchant_ID> with alias name <Merchant_ID>
139
174
- Second entry should be for `CyberSource_SJC_US` certificate with alias name as CyberSource_SJC_US
140
175
141
-
176
+
## PoolingHttpClient
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.
184
+
142
185
## Message Level Encryption
143
186
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.
144
187
@@ -156,10 +199,10 @@ CyberSource supports Message Level Encryption (MLE) for Simple Order API. Messag
156
199
157
200
## Retry Pattern
158
201
159
-
Retry Pattern allows to retry sending a failed request and it will only work with `useHttpClient=true`. `allowRetry` flag enables the retry mechanism.
202
+
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.
160
203
- 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'.
161
-
- numberOfRetries parameter value should be set between 0 to 5. By default the value for numberOfRetries will be 5. User can set a delay in between the retry attempts.
162
-
- Config parameter for this property is 'retryInterval' in `cybs.property` file. The default value for 'retryInterval' parameter is 5 which means a delay of 5 seconds.
204
+
- 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.
205
+
- 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.
163
206
164
207
## Third Party jars
165
208
1. org.apache.ws.security.wss4j:1.6.19
@@ -180,12 +223,27 @@ Retry Pattern allows to retry sending a failed request and it will only work wit
180
223
JUnit is a unit testing framework for Java.
181
224
9. org.mockito:mockito-all:1.10.19
182
225
Mock objects library for java
226
+
10. org.apache.httpcomponents:httpclient:4.5.11
227
+
Provides reusable components for client-side authentication, HTTP state management, and HTTP connection management. It is used for poolinghttpclientconnectionmanager feature.
0 commit comments