Like this?

messages.foreachRDD(rdd => {

if(rdd.count() > 0) //Do whatever you want.

})


Thanks
Best Regards

On Fri, Apr 24, 2015 at 11:20 PM, Sergio Jiménez Barrio <
drarse.a...@gmail.com> wrote:

> Hi,
>
> I need compare the count of messages recived if is 0 or not, but
> messages.count() return a DStream[Long]. I tried this solution:
>
> val cuenta  = messages.count().foreachRDD{ rdd =>
>                                                 rdd.first()
>                                              }
>
> But this return a type Unit, not Long.
>
>
> Any suggestion? Thanks!
>

Reply via email to