Hello, I am trying to get c++(publisher) to my scala(subscriber ) with little luck, I tried using both akka-zeromq and scala-zeromq to get this working with little luck. however, my program *does work* with *scala being the publisher and c++ being the subscriber (but not other way around)*, can anyone please help me figure out what I am doing wrong here !!
The following code will not work, I dont get any messages over on scala side, will be very grateful of any help here. ///////////// Scala Code , zmq version 2.2 import akka.actor._ import org.zeromq.ZMQ import org.zeromq.ZMQ._ object ZMQWithoutAkkaExtensionApp extends App { val numberOfMessages = 10 val system = ActorSystem("zmq") val subscriber = system.actorOf(Props[Sub]) subscriber ! "start" } class Sub extends Actor { var contextZMQ: ZMQ.Context = null var subscriberSocket: ZMQ.Socket = null override def preStart = { contextZMQ = ZMQ.context(1) subscriberSocket = contextZMQ.socket(ZMQ.SUB) subscriberSocket.connect("tcp://localhost:1234") subscriberSocket.subscribe("".getBytes()) Thread.sleep(1000) } def receive = { case msg => handleMessages } private def handleMessages = { while (true) { println("---------------------------------------------") val request = subscriberSocket.recv(0) println(s"request : $request") val data = new String(request) println(s"data : $data" ) } } } //////// C++ Code , zmq version 4.0.4 #include <zmq.hpp> #include <string> #include <iostream> #include <windows.h> #include <thread> using namespace std; void Pub() { cout << " Running Pub " << endl; zmq::context_t context(1); zmq::socket_t publisher(context, ZMQ_PUB); publisher.bind("tcp://*:1234"); Sleep(4000); cout << " awake again " << endl; int cc = 0; while (1) { // Write two messages, each with an envelope and content string msg = " hello "; zmq::message_t req(5); memcpy((void *)req.data(), "World", 5); publisher.send(req); cout << cc++ << endl; Sleep(1000); } } int main() { Pub(); return 0; } Thank you Sincerely, AVM -- >>>>>>>>>> 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.