I am trying to implement websocket using akka actors in play framework. Actors/FileUploaderActor.scala:
class FileUploaderActor extends Actor{ override def receive: Receive = { case UploadFile(billerId, filename, subCategory, count, dueDate) => val fileOberverActor = ActorSystem().actorOf(Props[FileObserverActor]) val billerData = BillerFileUploadMetaData(billerId,filename,count,"ACTIVE", new java.sql.Timestamp(new java.util.Date().getTime),subCategory,dueDate) val sparkSession = SparkContextHelper.sparkSession; import sparkSession.implicits._ val rdd = sparkSession.sparkContext.parallelize(Seq(billerData)) val df = rdd.toDF() df.write.format("org.apache.spark.sql.cassandra").options(Map("keyspace" -> "billerplatform_schema", "table" -> "biller_file_uploads")).mode(SaveMode.Append).save fileOberverActor ! FileUploaded(filename, count) }} Actors/FileObserverActor.scala: class FileObserverActor(out: ActorRef) extends Actor{ def receive = { case FileUploaded(fileName, totalRecords) => out ! ("Got the file " + fileName) } } object FileObserverActor{ def props(out: ActorRef) = Props(new FileObserverActor(out))} controller/HomeController.scala: def socket = WebSocket.accept[String, String] { request => ActorFlow.actorRef(out => FileObserverActor.props(out)) } I have created a companion object for "FileObserverActor" because its needed to establish a connection between controller and FileObserverActor through websocket. Now i also want to send message to "FileObserverActor" from "FileUploadActor", but i couldnt create a instance from "FileUploadActor" since the "FileObserverActor" is parameterised with "out:ActorRef" for websocket connection. Now how can i send a message to "FileObserverActor" from "FileUploadActor" ? Stack trace: java.lang.IllegalArgumentException: no matching constructor found on class Actors.FileObserverActor for arguments [] at akka.util.Reflect$.error$1(Reflect.scala:81) at akka.util.Reflect$.findConstructor(Reflect.scala:105) at akka.actor.NoArgsReflectConstructor.<init>(IndirectActorProducer.scala:103) at akka.actor.IndirectActorProducer$.apply(IndirectActorProducer.scala:60) at akka.actor.Props.producer(Props.scala:131) at akka.actor.Props.<init>(Props.scala:144) at akka.actor.Props$.apply(Props.scala:86) at Actors.FileUploaderActor$$anonfun$receive$1.applyOrElse(FileUploaderActor.scala:15) at akka.actor.Actor$class.aroundReceive(Actor.scala:497) at Actors.FileUploaderActor.aroundReceive(FileUploaderActor.scala:10) -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.