user9463688
user9463688

Reputation:

Why is ZeroMQ message scrambled?

I am using nodejs to call my tcp subscriber to read messages.

var zmq = require("zeromq"),
sock = zmq.socket("sub");
sock.connect("tcp://pubsub.besteffortc.com:7658");
sock.subscribe("/ASD/Travel");
console.log("Subscriber connected to port 3000");

sock.on("message", function(topic, message) {
  console.log(
    "received a message related to:",
    topic.toString(),
    "containing message:",
    message.toString()
  );
});

Output I am getting is the following. What might be the issue ? - can it be that my IP address needs to be whitelisted to see actual data ?

Note: Topic and URL name is not the actual value its dummy values. enter image description here

Upvotes: 1

Views: 178

Answers (1)

user3666197
user3666197

Reputation: 1

Q : What might be the issue ?

There is one sure point in the ZeroMQ - if a message gets delivered at all ( for which a Zen-of-Zero does not pose any warranty ), then it is sure to be an exact bit-by-bit copy of the message, that the originator ( the PUB in the case here ) was intending to .send()

If you .recv() anything ( be it by the native API level .recv()-method or the wrapper provided .on( "message", f(...){...} )-handler ), be sure it carries the 1:1 bitmap of the payload provided by the originator ( unless your language wrapper did a dirty job of obfuscating your use of the documented ZeroMQ API, producing some nasty garbage ( which I would not bet on, yet it might be an issue - try any other ZeroMQ message-source, that is under your own control, to see if this happens or not ) )

Q : can it be that my IP address needs to be whitelisted to see actual data ?

As explained in detail above, this item is not a ZeroMQ issue. If your app-level / ISO-OSI-above-5 behaviour depends on contracting some kind of abonnement, only after which you get "access-validation" ( be it by whitelisting or other kind ), then your problem stays in the business domain, not the programming one.

ZeroMQ has nothing to do with any of this. ZMQ/RFC-documentation is explicit on each ZeroMQ service-composition and leaves zero-space for random or undocumented behaviours.

Upvotes: 1

Related Questions