[zeromq-dev] Route to specific papa through broker

2012-04-26 Thread Lennon Pulda
I'm attempting to route to a specific REP socket while using a broker... I
read the guide around
http://zguide.zeromq.org/page:all#Address-based-Routing, although not
getting what I expect when using QUEUE device as a broker; I want to do
address-based routing through a QUEUE device, is it possible? Or do I have
to make a special broker?

My use-case is a command broker. There are named workers, REP connections
that have zmq.IDENTITY, and there are consoles which are clients that
send commands to the workers, addressing them by identity. A broker is in
between to allow easy connect /disconnect of consoles and workers. Picture
describes better:
http://imgur.com/mGCLp

Note this use case is not LRU or load balancing, it's routing to a specific
REP by name (identity) and replying to the source REQ. Is it possible to
achieve this with a broker?

This is what I roughly gathered from the guide but I wasn't able to get
specific routing:
http://pastebin.com/QsSnSf1U


Cheers
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Route to specific papa through broker

2012-04-26 Thread Pieter Hintjens
On Thu, Apr 26, 2012 at 8:11 AM, Lennon Pulda lenno...@gmail.com wrote:

 My use-case is a command broker. There are named workers, REP connections
 that have zmq.IDENTITY, and there are consoles which are clients that send
 commands to the workers, addressing them by identity. A broker is in
 between to allow easy connect /disconnect of consoles and workers. Picture
 describes better:
 http://imgur.com/mGCLp

Check the Majordomo pattern, and implementations in various languages.
It does what you need.

-Pieter
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] missing events ZMQ_FD / ZMQ_EVENTS

2012-04-26 Thread Gerhard Lipp
Hello Paul!

On Wed, Apr 25, 2012 at 8:29 PM, Paul Colomiets p...@colomiets.name wrote:
 Hi Gerhard,

 On Wed, Apr 25, 2012 at 6:08 PM, Gerhard Lipp gel...@googlemail.com wrote:
 i figured out to boil down an example, which shows this bug.
 it consists of three files:
 1) x.lua doing the XREP XREQ stuff, must be started once
 2) rep.lua implementing a simple echo replier, must be started once
 3) req.lua making the request to rep.lua through x.lua. must be
 started TWICE to produce the error. THIS PROCESS LOCKS. uncommenting
 the ev.WRITE is a bad workaround to this issue.

 As far as I can see, it not a workaround. It's just the way ZMQ_FD works.
 Uze zmq_poll if you don't feel comfortable for that. The only way you can 
 change
 that is returning getopt(zmq.EVENTS) instead of hardcoding ev.READ + ev.WRITE


According to the manual, the fd returned by zmq_getsockopt(ZMQ_FD)
signals any pending events on the socket in an edge-triggered fashion
by making the file descriptor become ready for reading.

If ev.WRITE is required to get all ZMQ_POLLIN and/or ZMQ_POLLOUT
events, the doc should be clearer. Anyhow, as the source looks like,
the ZMQ_FD is the fd associated with the socket's mailbox, which is
used for all kinds communication (state transitions?) inside of ZMQ. A
selecting/polling user process should not wake up unnecessarily to
avoid context switches, which are really expensive on our (embedded)
device. Thus i'd like to minimize the wakeups by just specifying
ev.READ.

 --
 Paul
 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Inproc socket vs traditional queue/event

2012-04-26 Thread Martin Pales
On Wed, Apr 25, 2012 at 8:02 PM, jonathan.me...@schneider-electric.comwrote:

 Hello,

 Has anyone ran any performance tests comparing a ZeroMQ inproc socket for
 asynchronous communications between threads vs a traditional approach with
 a queue and OS event to wake up blocked subscribers to that queue? I am
 evaluating using ZeroMQ for machine-machine communication but am also
 curious to use it for communications within the same process. I will be
 running some comparisons myself but thought I’d shoot out this question
 anyway to see how others have compared the two.


I don't have any concrete figures here, but in my experience it is very
similar. It really depends on what performance level do you need. You can
check ZeroMQ performance very quickly by setting up ZeroMQ and running
included performance tests.
I personally chose ZeroMQ over OS queue/event approach in multiple projects
due to the fact, that ZeroMQ gives you a great added value, not just the
basic queue functionality and performance.

Martin
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] missing events ZMQ_FD / ZMQ_EVENTS

2012-04-26 Thread Gerhard Lipp
Issue created.

On Thu, Apr 26, 2012 at 10:45 AM, Martin Hurton hurt...@gmail.com wrote:
 Thanks Gerhard, could you please create an issue in Jira? And please
 attach those Lua programs too. Thanks.

 - mh

 On Wed, Apr 25, 2012 at 5:08 PM, Gerhard Lipp gel...@googlemail.com wrote:
 i figured out to boil down an example, which shows this bug.
 it consists of three files:
 1) x.lua doing the XREP XREQ stuff, must be started once
 2) rep.lua implementing a simple echo replier, must be started once
 3) req.lua making the request to rep.lua through x.lua. must be
 started TWICE to produce the error. THIS PROCESS LOCKS. uncommenting
 the ev.WRITE is a bad workaround to this issue.

 ---
 -- x.lua:
 
 local zmq = require'zmq'
 local ev = require'ev'
 local c = zmq.init(1)
 local xreq = c:socket(zmq.XREQ)
 xreq:bind('tcp://127.0.0.1:1')
 local xrep = c:socket(zmq.XREP)
 xrep:bind('tcp://127.0.0.1:13334')
 local forward_io =
   function(src,dst)
      return ev.IO.new(
         function(loop,io)
            while true do
               local events = src:getopt(zmq.EVENTS)
               if events == zmq.POLLIN or events == (zmq.POLLIN +
 zmq.POLLOUT) then
                  local more
                  repeat
                     local data = src:recv()
                     local more = src:getopt(zmq.RCVMORE)  0
                     dst:send(data,more and zmq.SNDMORE or 0)
                  until not more
               else
                  break
               end
            end
         end,
         src:getopt(zmq.FD),
         ev.READ -- + ev.WRITE -- fixes the problem
      )
   end
 local xrep_io = forward_io(xrep,xreq)
 local xreq_io = forward_io(xreq,xrep)
 xreq_io:start(ev.Loop.default)
 xrep_io:start(ev.Loop.default)
 ev.Loop.default:loop()

 -
 -- req.lua
 --
 local zmq = require'zmq'
 local c = zmq.init(1)
 local req = c:socket(zmq.REQ)
 req:connect('tcp://127.0.0.1:13334')
 while true do
   local r = tostring(math.random(1,1000))
   req:send(r)
   local x = req:recv()
   print(x,r)
   assert(x==r)
 end

 -
 -- rep.lua
 
 local zmq = require'zmq'
 local c = zmq.init(1)
 local rep = c:socket(zmq.REP)
 rep:connect('tcp://127.0.0.1:1')
 while true do
   local x = rep:recv()
   rep:send(x)
 end



 On Mon, Apr 23, 2012 at 2:53 PM, Gerhard Lipp gel...@googlemail.com wrote:
 Hello,

 I can observe the same behavior as stated here
 (http://lists.zeromq.org/pipermail/zeromq-dev/2011-November/014615.html).
 What I observe is also a XREP/XREQ (ROUTER/DEALER) prob, where the
 XREQ is waiting forever to receive a message (which has been
 definitely sent). When I poll (timer based) the ZMQ_EVENTs, the XREQ
 is readable as expected. I am using libev (select based) for doing IO
 and I am aware of the edge-based trigger behaviour (I am
 reading/forwarding messages until ZMQ_EVENTs does not include the
 ZMQ_POLLIN bit any more).

 What is the status of this issue?
 Unfortunately my setup is a bit complicated to share, but i would like
 to help as much as possible.

 Regards,
 Gerhard

 A libev workaround is to use both EV_READ and EV_WRITE bits, though
 this adds a lot of unnecessary wake ups / callbacks etc.
 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev
 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Meetup in Chicago on May 19th

2012-04-26 Thread Ian Barber
On Wed, Apr 25, 2012 at 6:36 PM, Tom Cocagne tom.coca...@gmail.com wrote:


 When: May 19th, 2012 at 10am

 If you're interested in attending or (even better!) presenting please
 register at:

 http://www.zeromq.org/event:chicago-2012-05


Ooh, I'm flying in to Chicago on the 19th, should be there in the
afternoon/evening, so I'll try and get over for the tail end!

Ian
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Python / Zmq / Gevent

2012-04-26 Thread Antonio Teixeira
Hello Paul.

You can find it here
http://lists.zeromq.org/pipermail/zeromq-dev/2012-April/016832.html

Topic ZMQ Assert

I will cook some demo code when i have a spare time

Regards
A/T


2012/4/23 Paul Colomiets p...@colomiets.name

 Hi Antonio,

 On Mon, Apr 23, 2012 at 7:30 PM, Antonio Teixeira
 eagle.anto...@gmail.com wrote:
  Hello Paul.
 
  I will try to make reduce the code that does this :)
  By the way Paul you may want to check the logging module when using
 Gevent
  it SIGABORTS ZMQ , i wrote a previous mail regarding that :)
 

 Can't find. Can you point me?

 (We are using greenlets and zeromq successfully, so it's some gevent
 problem)

 --
 Paul
 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Meetup in Chicago on May 19th

2012-04-26 Thread Tom Cocagne
Excellent! Glad to hear it. I'm not sure about Midway but if you're
flying into O'Hare, the blue line train will take you directly to our
building (Union Station).

Tom


On Thu, Apr 26, 2012 at 10:33 AM, Ian Barber ian.bar...@gmail.com wrote:
 On Wed, Apr 25, 2012 at 6:36 PM, Tom Cocagne tom.coca...@gmail.com wrote:


 When: May 19th, 2012 at 10am

 If you're interested in attending or (even better!) presenting please
 register at:

 http://www.zeromq.org/event:chicago-2012-05


 Ooh, I'm flying in to Chicago on the 19th, should be there in the
 afternoon/evening, so I'll try and get over for the tail end!

 Ian

 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Route to specific papa through broker

2012-04-26 Thread Lennon Pulda
sweet.

On Thu, Apr 26, 2012 at 12:00 AM, Pieter Hintjens p...@imatix.com wrote:

 On Thu, Apr 26, 2012 at 8:11 AM, Lennon Pulda lenno...@gmail.com wrote:

  My use-case is a command broker. There are named workers, REP
 connections
  that have zmq.IDENTITY, and there are consoles which are clients that
 send
  commands to the workers, addressing them by identity. A broker is in
  between to allow easy connect /disconnect of consoles and workers.
 Picture
  describes better:
  http://imgur.com/mGCLp

 Check the Majordomo pattern, and implementations in various languages.
 It does what you need.

 -Pieter
 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


[zeromq-dev] jzmq problem

2012-04-26 Thread Paul Balomiri
Hi, 

I just installed libjzmq.so and libzmq.so on android.My first try to run the 
HelloWorld Example fails however.

I tried connecting from the emulator using
 socket.connect (tcp://10.0.2.2:12345);

On the server part I use the python example with the connect address:
 socket.bind(tcp://*:12345)

Whatever I try the sending and receiving part just ignore each other.

I have tested the connection using
  shell user$ nc -l   12345
on the server and connecting to the port using the adress
http://10.0.2.2:12345 in the builtin android browser. The test shows me a 
correct
HTML request. So i am fairly sure that it is not a connection problem.

Has anyone some idea where to look for the problem ?

Paul

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Meetup in Chicago on May 19th

2012-04-26 Thread Pieter Hintjens
So how about a Sunday morning brunch meetup to continue?

-Pieter

On Thu, Apr 26, 2012 at 5:33 PM, Ian Barber ian.bar...@gmail.com wrote:
 On Wed, Apr 25, 2012 at 6:36 PM, Tom Cocagne tom.coca...@gmail.com wrote:


 When: May 19th, 2012 at 10am

 If you're interested in attending or (even better!) presenting please
 register at:

 http://www.zeromq.org/event:chicago-2012-05


 Ooh, I'm flying in to Chicago on the 19th, should be there in the
 afternoon/evening, so I'll try and get over for the tail end!

 Ian

 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] jzmq problem

2012-04-26 Thread Paul Balomiri
Nevermind,

I just had a blackout on permissions:

I forgot to set android.permission.INTERNET

sorry for bothering
On Apr 26, 2012, at 9:13 PM, Paul Balomiri wrote:

 Hi, 
 
 I just installed libjzmq.so and libzmq.so on android.My first try to run the 
 HelloWorld Example fails however.
 
 I tried connecting from the emulator using
 socket.connect (tcp://10.0.2.2:12345);
 
 On the server part I use the python example with the connect address:
 socket.bind(tcp://*:12345)
 
 Whatever I try the sending and receiving part just ignore each other.
 
 I have tested the connection using
  shell user$ nc -l   12345
 on the server and connecting to the port using the adress
 http://10.0.2.2:12345 in the builtin android browser. The test shows me a 
 correct
 HTML request. So i am fairly sure that it is not a connection problem.
 
 Has anyone some idea where to look for the problem ?
 
 Paul
 

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] [zmq] problems on the instalation

2012-04-26 Thread Pieter Hintjens
Hi Eduardo,

These examples need CZMQ, which you can build and install before using
them. Get that from http://czmq.zeromq.org.

-Pieter

On Thu, Apr 26, 2012 at 7:41 PM, Eduardo Nunes eduardo.ke...@gmail.com wrote:
 i'm having some troubles to installing the zmq, i din't see in the guide
 any information to use the C library, so i find some simple instructions to
 follow, donwload the tarball, extract it, type ./configure, make, make
 install and sudo ldconfig, but whent i try to compile some C exemples it
 find the library but this happen when i try to run build for an exemple on
 the git exemples
 mdclient2.c
 mdclient2.o: In function `s_mdcli_connect_to_broker':
 mdclient2.c:(.text+0x11): undefined reference to `zsocket_destroy'
 mdclient2.c:(.text+0x1e): undefined reference to `zsocket_new'
 mdclient2.c:(.text+0x2e): undefined reference to `zmq_connect'
 mdclient2.o: In function `mdcli_new':
 mdclient2.c:(.text+0x95): undefined reference to `zctx_new'
 mdclient2.o: In function `mdcli_destroy':
 mdclient2.c:(.text+0x172): undefined reference to `zctx_destroy'
 mdclient2.o: In function `mdcli_send':
 mdclient2.c:(.text+0x215): undefined reference to `zmsg_pushstr'
 
 anyone knows if are some dummy documentations to use the library, because
 i'm trying this all day with no sucess.
 Thanks to everyone

 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev