You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Wouter Zorgdrager <zo...@gmail.com> on 2018/01/31 12:57:44 UTC

RichAsyncFunction in Scala

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

Re: RichAsyncFunction in Scala

Posted by Timo Walther <tw...@apache.org>.
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