slinkydeveloper commented on a change in pull request #110:
URL: https://github.com/apache/flink-statefun/pull/110#discussion_r426648148



##########
File path: 
statefun-flink/statefun-flink-core/src/main/java/org/apache/flink/statefun/flink/core/httpfn/HttpFunctionProvider.java
##########
@@ -41,12 +48,56 @@ public RequestReplyFunction functionOfType(FunctionType 
type) {
     if (spec == null) {
       throw new IllegalArgumentException("Unsupported type " + type);
     }
+    return new RequestReplyFunction(
+        spec.states(), spec.maxNumBatchRequests(), buildHttpClient(spec));
+  }
+
+  private RequestReplyClient buildHttpClient(HttpFunctionSpec spec) {
+    // We need to build a UDS HTTP client
+    if (spec.isUnixDomainSocket()) {
+
+      // We need to split the path in order to get the sock file and the path 
after the sock file
+      Map.Entry<String, String> splittedFilePathAndEndpoint =
+          splitFilePathAndEndpointForUDS(spec.endpoint());
+
+      OkHttpClient specificClient =
+          sharedClient
+              .newBuilder()
+              .socketFactory(
+                  new 
AFUNIXSocketFactory.FactoryArg(splittedFilePathAndEndpoint.getKey()))
+              .callTimeout(spec.maxRequestDuration())
+              .build();
+
+      return new HttpRequestReplyClient(
+          // Only the path matters!
+          HttpUrl.get(URI.create(splittedFilePathAndEndpoint.getValue())), 
specificClient);

Review comment:
       Ok I changed the invocation of `HttpUrl.get` to use the `String` 
override, where the documentation states
   
   ```
   @throws IllegalArgumentException If {@code url} is not a well-formed HTTP or 
HTTPS URL.
   ```
   
   Hopefully this should avoid silent errors




----------------------------------------------------------------
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.

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


Reply via email to