slinkydeveloper commented on a change in pull request #110:
URL: https://github.com/apache/flink-statefun/pull/110#discussion_r426645993
##########
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:
Ah, that's interesting... So I suppose we need a placeholder value like
https://github.com/square/okhttp/blob/master/samples/unixdomainsockets/src/main/java/okhttp3/unixdomainsockets/ClientAndServer.java#L48
----------------------------------------------------------------
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]