You may have noticed that there are several different types of "context" classes in JeroMQ.
Use ZContext. It is the current state of the art for JeroMQ.
Ctx, part of the zmq package, contains low-level implementation details of a ZeroMQ context.
It should not be used directly in code that uses the JeroMQ library.
ZMQ.Context was the first cut at a higher-level API for a ZeroMQ context.
Before destroying a ZMQ.Context, care must be taken to close any sockets and pollers that may have been created via the context. ZContext, by comparison, does this for you.
ZContext is an improvement over ZMQ.Context, lending itself to more concise, convenient, and safe usage.
ZContext implements the java.io.Closable interface, which makes it convenient to use in a try-with-resources statement. When a ZContext is closed, resources such as sockets and pollers are cleaned up automatically.
-
zguide: Getting the Context Right: general information about contexts in ZeroMQ
-
ZSocket: The next evolution of contexts (or lack thereof) in ZeroMQ?