Nitin Singh
Nitin Singh

Reputation: 21

In StateFun with Apache DataStream examples how do we connect to remote Stateful Functions

I have been going to through the below link explaining the usage of Stateful Function with DataStream. https://github.com/apache/flink-statefun/blob/7ec6664ed7edf14d441110745df4c8d79b5d3abd/docs/content/docs/sdk/flink-datastream.md

I am not able to find a working example of this.

Does anyone know where can a working example be found for the example in the above link?

I tried to use an example that I found from somewhere but it is using Embedded function & using the code below:

  StatefulFunctionEgressStreams out =
                StatefulFunctionDataStreamBuilder.builder("example")
                        .withDataStreamAsIngress(names)
                        .withFunctionProvider(GREET, unused -> new MyFunction())
                        .withRequestReplyRemoteFunction(
                                requestReplyFunctionBuilder(
                                        REMOTE_GREET, URI.create("http://localhost:5000/statefun"))
                                        .withMaxRequestDuration(Duration.ofSeconds(15))
                                        .withMaxNumBatchRequests(500))
                        .withEgressId(GREETINGS)
                        .withConfiguration(statefunConfig)
                        .build(env);

In the above code, withFunctionProvider method is used to wire an embedded function.

But in the example on the page https://github.com/apache/flink-statefun/blob/7ec6664ed7edf14d441110745df4c8d79b5d3abd/docs/content/docs/sdk/flink-datastream.md, they are not using embedded functions.

The link (https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-flink-datastream-example/src/main/java/org/apache/flink/statefun/examples/datastream/Example.java) to full code given in the README file is 404.

Upvotes: 2

Views: 121

Answers (0)

Related Questions