Hi, I am trying to migrate some examples from the zmq guide
(http://zguide.zeromq.org/page:all) to Akka. The wuserver example works in
one direction: the messages sent out by the publisher can be received by a
Java or Node.js client connected and subscribed. However, the other
direction does not work: the subscriber in Akka-Zmq cannot receive any
messages.
When trying the very first hello-world example, I found that the actor
cannot receive any message at all. The following is the short hwserver.scala
import akka.actor.Actor.Receive
import akka.actor.{ActorLogging, Actor, Props}
import akka.util.ByteString
import akka.zeromq._
/**
* Created by hbai on 5/4/15.
*/
object HwServer {
def props(zmq: ZeroMQExtension): Props = Props(new HwServer(zmq))
}
class HwServer(zmq: ZeroMQExtension) extends Actor with ActorLogging {
val bindAddress = "tcp://*5555"
val repSocket = zmq.newSocket(SocketType.Rep, Listener(self),
Bind(bindAddress))
override def receive: Receive = {
case m : ZMQMessage =>
println(s"Received ${m.frames.toString}")
sender ! m //ZMQMessage(ByteString("reply"))
case x @ _ =>
println(s"something received ${x}")
}
}
And, the following is the main:
import akka.actor.{Props, ActorSystem}
import akka.util.ByteString
import akka.zeromq._
/**
* Created by hbai on 5/1/15.
*/
object Main extends App {
val system = ActorSystem("sensity")
val zmq = ZeroMQExtension(system)
println(s"ZMQ ${zmq.version}" )
println("Starting hwServer")
val hwServer = system.actorOf(HwServer.props(zmq), name="hwServer")
}
I am using Scala 2.11.6, Akka 2.3.10, Java 1.8.0_40
--
>>>>>>>>>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.