[zeromq-dev] Subscribing in JAVA api

Robin Weisberg robin at scout-trading.com
Tue May 11 20:19:42 CEST 2010

Just started playing w/ the 2.0.6 version of ZMQ. Looks great so far! 

2 questions though:


One oddity I noticed... can java code subscribe using a precise match e.g. in c you hand a null terminated string as the topic to setsockopt. In java I guess the equivalent would be a string ending with "\u0000"?

>From what I can gather of the JNI code It seems like you can't specify a '\0' in the string from java since strlen would treat it as the end of the string.

            const char *value = env->GetStringUTFChars (optval, NULL);
            if (! value) {
                raise_exception (env, EINVAL);

            int rc = zmq_setsockopt (s, option, value, strlen (value));
            int err = errno;
            env->ReleaseStringUTFChars (optval, value);
            if (rc != 0) {
                raise_exception (env, err);

I guess I can use a different terminator for my topics. Still a bit odd.

Also what are the plans for PGM on windows? Read a few posts and it seems its not ready yet for general consumption yet. Are there instructions if we want to try to build it ourselves? Any ETA on a binary package?


More information about the zeromq-dev mailing list