ZeroMQ Callbacks for Java / Scala

I'm looking for any ZeroMQ wrapper for Java / Scala. I want to add callbacks to sockets, but zmq does not provide this functionality by default. Only blocking the "recv" operation. Another way is to create a loop and a Poller user, but maybe there are some other solutions?

+3


source to share


1 answer


Why not create a simple Actor that accepts a callback as the arg constructor and then just sits in a:

while( running ) { 
  callback ( subscriber.recv( 0 ).asInstanceOf[Array[Byte]] ) 
}

      



If speed is optional, you can also look at the AKKA ZeroMQ module , this follows the traditional non-blocking message. However, I found this to be much slower than vanilla JZMQ.

+2


source







All Articles