zeromq / cljzmq Goto Github PK
View Code? Open in Web Editor NEWClojure bindings for ØMQ
License: GNU General Public License v3.0
Clojure bindings for ØMQ
License: GNU General Public License v3.0
Hi there, I notice that there hasn't been any activity on this library in some time. Is it still maintained? If not should the readme be updated with a disclaimer?
The following sample doesnt work without the sleep statement, i have excluded jzmq and using jeromq. moreover i dont see any error.
(ns exp.distributed
(:use [clojure.tools.logging :only (warn info error)])
(:require [zeromq.zmq :as zmq]
[clojure.core.async :as async :refer :all]))
(defn start-subs []
(future
(let [ctx (zmq/context 1)]
(with-open [sub (doto (zmq/socket ctx :sub)
(zmq/connect "tcp://127.0.0.1:5556")
(zmq/subscribe "topic"))]
(dotimes [i 10]
(info (zmq/receive-str sub)))))
(info "listeners quits.")))
(defn start-pubs []
(future
(let [ctx (zmq/context 1)]
(with-open [pub (doto (zmq/socket ctx :pub)
(zmq/bind "tcp://*:5556"))]
(Thread/sleep 1000);removing this doesnt works
(dotimes [i 10]
(zmq/send-str pub (format "topic %d" i)))))
(info "publisher quits.")))
(do
(start-subs)
(start-pubs))
Thank you.
I think we just need another multimethod.
(defmethod close org.zeromq.ZMQ$Context
[^org.zeromq.ZMQ$Context zctx]
(.term zctx))
Although i am little confused why doesnt cljzmq's context match with JeroMQ's ZContext.
if I create a project and add the cljzmq dep and try to require it, it fails trying to load jzmq, if I add it to the deps with something like:
:dependencies [[org.clojure/clojure "1.5.1"]
[org.zeromq/jzmq "2.2.1"]
[org.zeromq/cljzmq "0.1.1"]]
it fails in the repl with
user=> (require '[zeromq.zmq :as zmq])
UnsatisfiedLinkError no jzmq in java.library.path java.lang.ClassLoader.loadLibrary (ClassLoader.java:1856)
which is the recommended way to make it work?
I am a newbie so forgive my naive question in advance.
deftest send-str-timeout-test in zmq-test.clj returns the following exception:
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: No such var: zmq/set-send-timeout, compiling:(/Users/spaceshuttle/Documents/FP/Clojure/source_code/my-code/second-jzmq/test/second_jzmq/zmq-test.clj:26:20)
is this what I should be expecting? or did I go wrong somewhere? Thanks for your help in advance.
A few short examples would go a long way
I get the following reflection warning for cljzmq:
Reflection warning, zeromq/zmq.clj:161:6 - call to method send on org.zeromq.ZMQ$Socket can't be resolved (no such method).
Hello, trying to get the examples working, but am getting a java.lang.UnsatisfiedLinkError error. Here's my steps:
I installed the latest zeromq via brew:
joker:~ dan.young$ brew install zeromq
==> Downloading http://download.zeromq.org/zeromq-4.0.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/zeromq-4.0.4.tar.gz
==> ./configure --prefix=/usr/local/Cellar/zeromq/4.0.4
==> make
==> make install
==> Caveats
To install the zmq gem on 10.6 with the system Ruby on a 64-bit machine,
you may need to do:
ARCHFLAGS="-arch x86_64" gem install zmq -- --with-zmq-dir=/usr/local/opt/zeromq
==> Summary
🍺 /usr/local/Cellar/zeromq/4.0.4: 62 files, 2.7M, built in 36 seconds
joker:~ dan.young$
joker:~ dan.young$ ls -lrt /usr/local/lib/libz*
lrwxr-xr-x 1 dan.young staff 39 Apr 21 11:01 /usr/local/lib/libzmq.dylib -> ../Cellar/zeromq/4.0.4/lib/libzmq.dylib
lrwxr-xr-x 1 dan.young staff 35 Apr 21 11:01 /usr/local/lib/libzmq.a -> ../Cellar/zeromq/4.0.4/lib/libzmq.a
lrwxr-xr-x 1 dan.young staff 41 Apr 21 11:01 /usr/local/lib/libzmq.3.dylib -> ../Cellar/zeromq/4.0.4/lib/libzmq.3.dylib
Here's my project.clj:
(defproject zero-mq "0.1.0-SNAPSHOT"
:description "zero mq"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[org.zeromq/cljzmq "0.1.4"]]
:jvm-opts ["-Djava.library.path=/usr/lib:/usr/local/lib"]
:main zero-mq.rrbroker)
in my zero-mq.rrbroker
ns zero-mq.rrbroker
(:require [zeromq.zmq :as zmq]
))
(println (. System getProperty "java.library.path"))
then try to run lein repl
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jzmq in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1764)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1044)
Any idea on what I'm doing wrong?
Presently, receive-str
will raise a NullPointerException
if a timeout occurs after (.setReceiveTimeOut socket timeout)
. I believe that it should return nil
. What is the correct behavior?
I am getting the dreaded unsatisfied link error. I spent some time chasing it today. I notice that ldconfig does not create a softlink pointing libzmq.so.0 to blahblah/libmq.so.3 . Should it?
Why is cljzmq 0.1.4 looking for .0?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.