2

I am going through the examples on the ZeroMQ website and all the Java examples don't work for the jzmq library. I think they work with the other Java implementation but the project I am working on is using jzmq. Are there examples anywhere for JZMQ?

Specifically, how do you create a Poller? The example has:

context.createPoller(2);

There is a method on the context that is depreciated:

context.getContext().poller();

And says to use the constructor but the ZMQ.Poller constructor is protected.

How are you supposed to construct one?

user3666197
  • 1
  • 6
  • 50
  • 92
devo
  • 1,290
  • 1
  • 15
  • 28

1 Answers1

0

I found a code sample that creates a poller using JZMQ 3.1.0 library. It is just a little different than the other java API.

   //You use the constructor that takes the number of pollers
   ZMQ.Poller poller = new ZMQ.Poller(2);
   //then you register your socket contexts
   int id1 = poller.register(socket1, ZMQ.Poller.POLLIN);
   int id2 = poller.register(socket2, ZMQ.Poller.POLLIN);

Hope this helps someone else.

devo
  • 1,290
  • 1
  • 15
  • 28