exceptionfactory commented on code in PR #11764:
URL: https://github.com/apache/nifi/pull/11764#discussion_r4200046603


##########
nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/GetSplunk.java:
##########
@@ -574,18 +575,45 @@ protected Service createSplunkService(final 
ProcessContext context) {
         }
 
         final SSLContextProvider sslContextProvider = 
context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextProvider.class);
-        if (sslContextProvider != null) {
-            // Service construction reapplies the static security protocol and 
replaces the Socket Factory when that protocol changes.
-            // Leaving the protocol unchanged keeps the Socket Factory 
supplied by the SSL Context Service.
-            
Service.setSSLSocketFactory(sslContextProvider.createContext().getSocketFactory());
+        final StandardWebClientService client;
+        if (sslContextProvider == null) {
+            client = null;
+        } else {
+            client = getWebClientService(sslContextProvider, host, 
connectTimeout, readTimeout);
         }
 
         final String chosenApiVersion = 
context.getProperty(API_VERSION).getValue();
         final boolean enableV2SearchApi = 
API_VERSION_V2.getValue().equals(chosenApiVersion);
 
         serviceArgs.add("enableV2SearchApi", enableV2SearchApi);
 
-        return Service.connect(serviceArgs);
+        return SplunkWebClients.connect(serviceArgs, client);
+    }
+
+    private StandardWebClientService getWebClientService(
+            final SSLContextProvider sslContextProvider,
+            final String host,
+            final int connectTimeout,
+            final int readTimeout
+    ) {
+        if (webClientService == null) {
+            webClientService = SplunkWebClients.create(sslContextProvider, 
host, getLogger());
+            if (connectTimeout > 0) {
+                
webClientService.setConnectTimeout(Duration.ofMillis(connectTimeout));
+            }
+            if (readTimeout > 0) {

Review Comment:
   That is accurate, the applicability of the read timeout is limited to 
receiving the response headers, but this is true of other uses of 
`StandardWebClientService`. Although it does not enforce the exact same 
semantics as the earlier behavior, it is a best effort configuration setting, 
which could be addressed in the client itself separately.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to