[zeromq-dev] Initial support for zmq_poll() under Java

Brian Granger ellisonbg at gmail.com
Thu Feb 25 21:22:03 CET 2010


>> Rather than using the zmq.REP|REQ... flags.  I did not implement this
>> as it seemed to go too afar from the C/C++ bindings.
>
> Or perhaps have them implement a single interface (does that exist in
> Python?).

Python does not have interfaces in the Java sense.

>> My interface to poll in modeled on Python's built-in select.poll
> module:
>>
>> It has a Poller class which you create and then call register to add
>> fds/sockets:
>>
>> p = Poller()
>> p.register(s1)
>> p.register(s2)
>> p.poll(timeout=10)
>> p.unregister(s1)
>
> How do you enquire which sockets where "signaled", and which "signals"
> each of them received?

p.poll returns a list of 2 tuples of the form (socket, signals).

>> Overall, the core API of the Python bindings follows the C/C++ very
>> closely though.
>>
>> I am willing to change some of the core API of the Python bindings if
>> needed but I do think it is important
>> for each language to create an API that follows the spirit of the
>> language.
>
> I agree. If, for example, Python (or Ruby, or Clojure) does not support
> interfaces, perhaps I will want to use them in Java anyway.

Right, it very well might make sense to use interfaces in Java.

> What I think we could do is to agree on a "feel" for all the
> OO-languages bindings to 0MQ. For example:
>
> * Having everything in a single package / class / namespace vs. having
> separate classes.

Yes, I think that is an important decision.

> * Being more OO (like your socket creation example above) vs. staying
> close to the C/C++ API.

This too.

Cheers,

Brian



More information about the zeromq-dev mailing list