[ 
https://issues.apache.org/jira/browse/FLINK-21420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17287658#comment-17287658
 ] 

Miguel Araujo commented on FLINK-21420:
---------------------------------------

Hi [~tzulitai], [~igal],

I was considering opening a PR to fix this issue, here is what I would change:
 * Adding StatefulFunctionDataStreamBuilder.withRequestReplyNamespace (naming 
suggestions welcome..).
 ** HttpFunctionEndpointSpec already supports path templating, so this would 
just create one with a NamespaceTarget and a UrlPathTemplate.
 ** I think adding a new method to the StatefulFunctionDataStreamBuilder is 
better than overloading the behavior of .withRequestReplyRemoteFunction as that 
could be confusing.
 * Renaming StatefulFunctionDataStreamBuilder.requestReplyFunctions to 
specificTypeEndpointSpecs.
 * Adding StatefulFunctionDataStreamBuilder.perNamespaceEndpointSpecs.
 * Make SerializableHttpFunctionProvider's behavior with namespace endpoints 
akin to the behavior of HttpFunctionProvider. This would mean changing 
(overloading) the constructor to receive an additional `Map<String, 
HttpFunctionEndpointSpec> perNamespaceEndpointSpecs`.
 * Changing the build()  method of StatefulFunctionDataStreamBuilder to use the 
new SerializableHttpFunctionProvider's constructor.

WDYT?

Unfortunately, I think DataStreams + Remote functions are not being tested 
anywhere, or at least I couldn't find a suitable test to modify.

> Add path templating to the DataStream API
> -----------------------------------------
>
>                 Key: FLINK-21420
>                 URL: https://issues.apache.org/jira/browse/FLINK-21420
>             Project: Flink
>          Issue Type: Improvement
>          Components: Stateful Functions
>            Reporter: Miguel Araujo
>            Priority: Major
>
> Path Template was introduced in FLINK-20264 with a new module YAML 
> specification being added in FLINK-20334.
> However, that possibility was not added to the DataStream API.
> The main problem is that RequestReplyFunctionBuilder can only receive 
> FunctionTypes which it then turns into FunctionTypeTarget's for the 
> HttpFunctionEndpointSpec builder:
> {code:java}
> private RequestReplyFunctionBuilder(FunctionType functionType, URI endpoint) {
>   this.builder =
>       HttpFunctionEndpointSpec.builder(
>           Target.functionType(functionType), new 
> UrlPathTemplate(endpoint.toASCIIString()));
> }
> {code}
> It should also be possible for the RequestReplyFunctionBuilder to receive a 
> namespace instead of a function type and to use `Target.namespace(namespace)` 
> to initialize the HttpFunctionEndpointSpec Builder instead.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to