简体   繁体   中英

ZeroMQ Callbacks for Java/Scala

I'm looking for any wrapper for ZeroMQ for Java/Scala. I want to add callbacks to sockets, but by default zmq doesn't provide this feature. Only blocking operation 'recv'. Another way is to create loop and user Poller, but maybe exists some other solutions?

Why not create a simple Actor that would take in a callback as a constructor arg and then just sit in a:

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

If the speed is not a requirement, you can also look at AKKA ZeroMQ module, it follows a traditional non blocking message passing. However I found it a lot slower that a vanilla JZMQ.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM