Unable to deserialize ActorRef to send result to different Actor

天大地大妈咪最大 提交于 2019-12-05 14:12:29

Look at the following example to access an actor outside of the Spark domain.

/* * Following is the use of actorStream to plug in custom actor as receiver * * An important point to note: * Since Actor may exist outside the spark framework, It is thus user's responsibility * to ensure the type safety, i.e type of data received and InputDstream * should be same. * * For example: Both actorStream and SampleActorReceiver are parameterized * to same type to ensure type safety. */

val lines = ssc.actorStream[String](
  Props(new SampleActorReceiver[String]("akka.tcp://test@%s:%s/user/FeederActor".format(
    host, port.toInt))), "SampleReceiver")

I found that if I collect before I send to the actor it works like a charm:

result.foreachRDD(rdd =>  rdd.collect().foreach(producer ! _))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!