Balaji Reddy Balaji Reddy - 1 year ago 187
Java Question

Convert a DStream to JavaDStream

I know we have an option for


JavaRDD<String> javaRDD = coreRdd.toJavaRDD();`

is it possible to convert Dstream to JavaDStream?

Answer Source

Yes, you can use the static JavaDStream<T>.fromDStream:

JavaDStream<String> javaDStream = 

Another option would be to use the class constructor, which takes an existing DStream:

JavaDStream<String> javaDStream = 
   new JavaDStream<String>(dStream, scala.reflect.ClassTag$.MODULE$.apply(String.class))