danlarkin / jzmq-native-deps

ZeroMQ Java bindings all packaged up and ready for use with leiningen + native-deps + clojars.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jzmq-native-deps

ZeroMQ Java bindings all packaged up and ready for use with leiningen + native-deps + clojars.org. Includes linux x86 and mac x86_64 //will include window x86, and window x86_64. Please fork and build for other architectures!

Jzmq version used

jzmq

commit number: ee2d21e1aa9ecd4e1a0b

commit comment: Added support for unregistering sockets from poller.

commit date: December 29, 2010

Usage in Project.clj

In your project.clj: :dev-dependencies [[native-deps "1.0.5"]] :native-dependencies [[org.clojars.starry/jzmq-native-deps "2.0.10"]]

and then just type lein native-deps

You also need to install zeromq 2.0.10 separately for your platform

zeromq

Usage

The key thing to remember is that sockets are not thread safe. And they cant be made thread safe with locks - only the thread which creates the socket should use it in any manner! A context is thread safe. This is not really as bad as it might seem at first, however. At least for me - i use it by having a thread which acts a 'service' and accepts requests from the program and then sends them over the socket. I use a poller which polls over local requests (over inproc) and over external events (tcp, etc.) Read the zeromq manual to actually understand this!

Example usage is here:

JZMQ thin wrapper

Wrapping for thread service

Thread Service

Acknowledgements

This concept borrows from and updates this library from clojars' mikejs.

License

Distributed under the Eclipse Public License, the same as Clojure.

About

ZeroMQ Java bindings all packaged up and ready for use with leiningen + native-deps + clojars.org