You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lastly, the high-water marks are counted in message parts, not whole messages. If you are sending two-part messages, the default HWM is 500. When you use the ROUTER socket type (discussed in detail in the next chapter), every message is at least two parts.
in section High-Water Marks, Chapter 2, ZeroMQ by Pieter Hintjens, O'Reilly Media, Inc., 2013
But when I tested sending mutli-part messages, I found that a multi-part message is actually treated as a single message by high-water mark.
e.g., the following code with jzmq
package org.zeromq;
import java.util.Collection;
/**
* Simple App to display version information about jzmq.
*
*/
public class App {
public static void main(final String[] args) throws Exception {
final Package p = App.class.getPackage();
final String appname = p.getSpecificationTitle();
final String versionMaven = p.getSpecificationVersion();
String[] version = new String[] { "", "" };
if (p.getImplementationVersion() != null) {
version = p.getImplementationVersion().split(" ", 2);
}
String zmqVersion = null;
try {
final int major = ZMQ.version_major();
final int minor = ZMQ.version_minor();
final int patch = ZMQ.version_patch();
zmqVersion = major + "." + minor + "." + patch;
} catch (Throwable x) {
zmqVersion = "ERROR! " + x.getMessage();
}
final String fmt = "%-7.7s %-15.15s %s%n";
System.out.printf(fmt, "ZeroMQ", "version:", zmqVersion);
System.out.printf(fmt, appname, "version:", versionMaven);
System.out.printf(fmt, appname, "build time:", version[1]);
System.out.printf(fmt, appname, "build commit:", version[0]);
System.out.println();
System.out.println("JNI lib location: "
+ (EmbeddedLibraryTools.LOADED_EMBEDDED_LIBRARY ? "embedded" : "java.library.path"));
System.out.println("current platform: " + EmbeddedLibraryTools.getCurrentPlatformIdentifier());
final Collection<String> files = EmbeddedLibraryTools.getEmbeddedLibraryList();
for (final String file : files) {
System.out.println("embedded library: " + file);
}
ZMQ.Context context = ZMQ.context(1);
// Socket to talk to server
System.out.println("Connecting to hello world server");
ZMQ.Socket socket = context.socket(ZMQ.DEALER);
socket.setSndHWM(4L);
socket.connect("inproc://ventilator");
for(int requestNbr = 0; requestNbr != 10; requestNbr++) {
String request = "Hello";
System.out.println("Sending Hello " + requestNbr );
socket.send(request, ZMQ.SNDMORE);
socket.send(request, ZMQ.SNDMORE);
socket.send(request, ZMQ.SNDMORE);
socket.send(request, ZMQ.SNDMORE);
socket.send(request);
Thread.sleep(1000);
}
socket.close();
context.term();
}
}
Hello,
I read of
in section High-Water Marks, Chapter 2, ZeroMQ by Pieter Hintjens, O'Reilly Media, Inc., 2013
But when I tested sending mutli-part messages, I found that a multi-part message is actually treated as a single message by high-water mark.
e.g., the following code with jzmq
output
(and it blocked at
Sending Hello 4
)If hwk treats a multi-part message as multiple messages, then it should have blocked at the first message.
So does it mean that zeromq has changed since the book was published?
Thank you!
The text was updated successfully, but these errors were encountered: