Hello, Thank you very much for all your help, I was earlier using zeromq version 4.1 but downgraded it to 2.2 yesterday. Now my problem is that everytime when I run my example it always enters the case of connecting. Please advise if more information is needed.
import akka.util.ByteString import akka.zeromq._ import akka.actor._ import scala.concurrent.duration._ import scala.concurrent.ExecutionContext.Implicits.global class Sub extends Actor{ def receive = { //case m:ZMQMessage if m.frames(0).utf8String == "hello" => println(m.frames(1).toString()) case m:ZMQMessage => println("************* from subscriber *****************") //;println(m.frames(1).toString()) case ss :String => println (" ---- some string appeared ") case Connecting => println("connection issue") case default => println(s"Running default case -- Unexpected value $default") } } class Pub extends Actor{ //creates a publisher socket bound to host at port 1235 val pubSocket = ZeroMQExtension(context.system).newSocket(SocketType.Pub, Bind("tcp://127.0.0.1:1234")) def receive={ case msg:String => //println(s"Got Message $msg") pubSocket ! ZMQMessage(ByteString("hello"), ByteString("this is test message")) } } object main extends App { println("Starting App.") val system = ActorSystem("system") val pubActor = system.actorOf(Props[Pub]) val subActor = system.actorOf(Props[Sub]) val subSocket = ZeroMQExtension(system).newSocket(SocketType.Sub, Listener(subActor), Connect("tcp://127.0.0.1:1234"), SubscribeAll) system.scheduler.schedule(10 seconds, 0 minutes)(pubActor ! "Message to Pub") println("Exiting main.") } -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- my build.sbt name := "Akka ZeroMQ Example" version := "1.0" scalaVersion := "2.10.4" val akkaV = "2.3.6" resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/" resolvers += "Sonatype (releases)" at "https://oss.sonatype.org/content/repositories/releases/" libraryDependencies += "org.zeromq" %% "zeromq-scala-binding" % "0.0.6" libraryDependencies += "com.typesafe.akka" %% "akka-actor" % akkaV libraryDependencies += "com.typesafe.akka" %% "akka-zeromq" % akkaV libraryDependencies += "com.typesafe.akka" %% "akka-remote" % akkaV -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- output of the above program, info] Running main Starting App. [DEBUG] [12/02/2014 13:18:48.481] [run-main] [EventStream(akka://system)] logger log1-Logging$DefaultLogger started [DEBUG] [12/02/2014 13:18:48.482] [run-main] [EventStream(akka://system)] Default Loggers started OpenJDK 64-Bit Server VM warning: You have loaded library /tmp/jna7595689729881225335.tmp which might have disabled stack guard. The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'. Exiting main. connection issue <-------------------------------------------------------------------- Output On Tuesday, December 2, 2014 12:10:44 AM UTC-8, √ wrote: > > Hi Ankit, > > You omitted the version of 0mq you are using, did you check the docs for > supported versions? > > Cheers, > V > On 1 Dec 2014 23:02, "ankit master" <ankit....@gmail.com <javascript:>> > wrote: > >> Hello, >> >> I am using CentOS 6.4 and am running into all sorts of troubles running >> Akka zeromq. I have zeromq and jzmq installed on my machine >> (/usr/local/lib). I am writing this very simple toy program but fail to get >> it working, following is the code and its output, I would greatly >> appreciate all your help in getting this working. I tried for several days >> but all of my efforts seem to be futile. >> >> import akka.util.ByteString >> import akka.zeromq._ >> import akka.actor._ >> import scala.concurrent.duration._ >> import scala.concurrent.ExecutionContext.Implicits.global >> >> >> class Sub extends Actor{ >> def receive = { >> //case m:ZMQMessage if m.frames(0).utf8String == "hello" => >> println(m.frames(1).toString()) >> case m:ZMQMessage => println("************* from subscriber >> *****************") //;println(m.frames(1).toString()) >> case ss :String => println (" ---- some string appeared ") >> case _ => println("something happened") >> } >> } >> >> >> class Pub extends Actor{ >> >> //creates a publisher socket bound to host at port 1235 >> val pubSocket = >> ZeroMQExtension(context.system).newSocket(SocketType.Pub, Bind("tcp:// >> 127.0.0.1:1234")) >> >> def receive={ >> case msg:String => >> //println(s"Got Message $msg") >> pubSocket ! ZMQMessage(ByteString("hello"), ByteString("this is >> test message")) >> } >> } >> >> object main extends App { >> >> println("Starting App.") >> >> val system = ActorSystem("system") >> >> val pubActor = system.actorOf(Props[Pub]) >> val subActor = system.actorOf(Props[Sub]) >> >> >> // sockets are created using ZeroMQExtension >> // creates a subscriber socket >> val subSocket = ZeroMQExtension(system).newSocket(SocketType.Sub, >> Listener(subActor), Connect("tcp://127.0.0.1:1234"), SubscribeAll) >> >> system.scheduler.schedule(1 seconds, 0 minutes)(pubActor ! "Message to >> Pub") >> >> println("Exiting main.") >> } >> >> >> >> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >> >> >> [info] Running main >> Starting App. >> OpenJDK 64-Bit Server VM warning: You have loaded library >> /tmp/jna7282295364414175580.tmp which might have disabled stack guard. The >> VM will try to fix the stack guard now. >> It's highly recommended that you fix the library with 'execstack -c >> <libfile>', or link it with '-z noexecstack'. >> Exiting main. >> something happened >> [ERROR] [12/01/2014 13:50:41.500] >> [system-akka.actor.default-dispatcher-2] [akka://system/user/zeromq/$a] No >> such file or directory >> org.zeromq.ZMQException: No such file or directory >> at org.zeromq.ZMQ$Socket.raiseZMQException(ZMQ.java:480) >> at org.zeromq.ZMQ$Socket.send(ZMQ.java:378) >> at >> akka.zeromq.ConcurrentSocketActor.flushMessage(ConcurrentSocketActor.scala:161) >> at >> akka.zeromq.ConcurrentSocketActor.akka$zeromq$ConcurrentSocketActor$$flush(ConcurrentSocketActor.scala:170) >> at >> akka.zeromq.ConcurrentSocketActor$$anonfun$receive$1.applyOrElse(ConcurrentSocketActor.scala:50) >> at akka.actor.Actor$class.aroundReceive(Actor.scala:465) >> at >> akka.zeromq.ConcurrentSocketActor.aroundReceive(ConcurrentSocketActor.scala:30) >> at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) >> at akka.actor.ActorCell.invoke(ActorCell.scala:487) >> at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238) >> at akka.dispatch.Mailbox.run(Mailbox.scala:220) >> at >> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) >> at java.lang.Thread.run(Thread.java:744) >> >> [INFO] [12/01/2014 13:50:41.507] [system-akka.actor.default-dispatcher-3] >> [akka://system/user/zeromq/$a] Message [akka.zeromq.ZMQMessage] from >> Actor[akka://system/user/$a#-1772810193] to >> Actor[akka://system/user/zeromq/$a#-1334917411] was not delivered. [1] dead >> letters encountered. This logging can be turned off or adjusted with >> configuration settings 'akka.log-dead-letters' and >> 'akka.log-dead-letters-during-shutdown'. >> [INFO] [12/01/2014 13:50:41.507] [system-akka.actor.default-dispatcher-3] >> [akka://system/user/zeromq/$a] Message [akka.zeromq.ZMQMessage] from >> Actor[akka://system/user/$a#-1772810193] to >> Actor[akka://system/user/zeromq/$a#-1334917411] was not delivered. [2] dead >> letters encountered. This logging can be turned off or adjusted with >> configuration settings 'akka.log-dead-letters' and >> 'akka.log-dead-letters-during-shutdown'. >> [INFO] [12/01/2014 13:50:41.512] [system-akka.actor.default-dispatcher-3] >> [akka://system/user/zeromq/$a] Message [akka.zeromq.ZMQMessage] from >> Actor[akka://system/user/$a#-1772810193] to >> Actor[akka://system/user/zeromq/$a#-1334917411] was not delivered. [3] dead >> letters encountered. This logging can be turned off or adjusted with >> configuration settings 'akka.log-dead-letters' and >> 'akka.log-dead-letters-during-shutdown'. >> [INFO] [12/01/2014 13:50:41.521] [system-akka.actor.default-dispatcher-3] >> [akka://system/user/zeromq/$a] Message [akka.zeromq.ZMQMessage] from >> Actor[akka://system/user/$a#-1772810193] to >> Actor[akka://system/user/zeromq/$a#-1334917411] was not delivered. [4] dead >> letters encountered. This logging can be turned off or adjusted with >> configuration settings 'akka.log-dead-letters' and >> 'akka.log-dead-letters-during-shutdown'. >> [INFO] [12/01/2014 13:50:41.531] [system-akka.actor.default-dispatcher-3] >> [akka://system/user/zeromq/$a] Message [akka.zeromq.ZMQMessage] from >> Actor[akka://system/user/$a#-1772810193] to >> Actor[akka://system/user/zeromq/$a#-1334917411] was not delivered. [5] dead >> letters encountered. This logging can be turned off or adjusted with >> configuration settings 'akka.log-dead-letters' and >> 'akka.log-dead-letters-during-shutdown'. >> [INFO] [12/01/2014 13:50:41.541] [system-akka.actor.default-dispatcher-3] >> [akka://system/user/zeromq/$a] Message [akka.zeromq.ZMQMessage] from >> Actor[akka://system/user/$a#-1772810193] to >> Actor[akka://system/user/zeromq/$a#-1334917411] was not delivered. [6] dead >> letters encountered. This logging can be turned off or adjusted with >> configuration settings 'akka.log-dead-letters' and >> 'akka.log-dead-letters-during-shutdown'. >> [INFO] [12/01/2014 13:50:41.551] [system-akka.actor.default-dispatcher-3] >> [akka://system/user/zeromq/$a] Message [akka.zeromq.ZMQMessage] from >> Actor[akka://system/user/$a#-1772810193] to >> Actor[akka://system/user/zeromq/$a#-1334917411] was not delivered. [7] dead >> letters encountered. This logging can be turned off or adjusted with >> configuration settings 'akka.log-dead-letters' and >> 'akka.log-dead-letters-during-shutdown'. >> [INFO] [12/01/2014 13:50:41.561] [system-akka.actor.default-dispatcher-3] >> [akka://system/user/zeromq/$a] Message [akka.zeromq.ZMQMessage] from >> Actor[akka://system/user/$a#-1772810193] to >> Actor[akka://system/user/zeromq/$a#-1334917411] was not delivered. [8] dead >> letters encountered. This logging can be turned off or adjusted with >> configuration settings 'akka.log-dead-letters' and >> 'akka.log-dead-letters-during-shutdown'. >> [INFO] [12/01/2014 13:50:41.571] [system-akka.actor.default-dispatcher-3] >> [akka://system/user/zeromq/$a] Message [akka.zeromq.ZMQMessage] from >> Actor[akka://system/user/$a#-1772810193] to >> Actor[akka://system/user/zeromq/$a#-1334917411] was not delivered. [9] dead >> letters encountered. This logging can be turned off or adjusted with >> configuration settings 'akka.log-dead-letters' and >> 'akka.log-dead-letters-during-shutdown'. >> [INFO] [12/01/2014 13:50:41.582] [system-akka.actor.default-dispatcher-3] >> [akka://system/user/zeromq/$a] Message [akka.zeromq.ZMQMessage] from >> Actor[akka://system/user/$a#-1772810193] to >> Actor[akka://system/user/zeromq/$a#-1334917411] was not delivered. [10] >> dead letters encountered, no more dead letters will be logged. This logging >> can be turned off or adjusted with configuration settings >> 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'. >> >> >> >> Thank you in advance >> Sincerely, >> AM >> >> -- >> >>>>>>>>>> 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+...@googlegroups.com <javascript:>. >> To post to this group, send email to akka...@googlegroups.com >> <javascript:>. >> Visit this group at http://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > -- >>>>>>>>>> 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 http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.