RichAsyncFunction in Scala

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

RichAsyncFunction in Scala

Wouter Zorgdrager
Hi,

Currently there is no way of using the RichAsyncFunction in Scala, this means I can't get access to the RuntimeContext. I know someone is working on this: https://issues.apache.org/jira/browse/FLINK-6756 , however in the meantime is there a workaround for this? I'm particularly interested in getting the index of the subtask in my AsyncFunction. 

Regards,
Wouter
Reply | Threaded
Open this post in threaded view
|

Re: RichAsyncFunction in Scala

Timo Walther
Hi Wouter,

you could use the Java classes as a workaround. If you take a look at
the implementation [1], you will see that Scala only wraps the Java
classes. I think you can implement the same. You can convert your result
stream back into a Scala stream by calling `new
o.a.f.streaming.api.scala.DataStream#DataStream(javaStream)`.

I hope that helps.

Regards,
Timo

[1]
https://github.com/apache/flink/blob/master/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/AsyncDataStream.scala#L70



Am 1/31/18 um 1:57 PM schrieb Wouter Zorgdrager:

> Hi,
>
> Currently there is no way of using the RichAsyncFunction in Scala,
> this means I can't get access to the RuntimeContext. I know someone is
> working on this: https://issues.apache.org/jira/browse/FLINK-6756 ,
> however in the meantime is there a workaround for this? I'm
> particularly interested in getting the index of the subtask in my
> AsyncFunction.
>
> Regards,
> Wouter