[zeromq-dev] What prevents reading a message self sent ?
Laurent Alebarde
l.alebarde at free.fr
Tue Jan 28 10:00:55 CET 2014
Let's clarify:
Process client proxy1 proxy2 worker
| |-----------| |----------| |
socket cl f1 b1 f2 b2 wk
endpoint |c----e1-----b| |c----e2-----b| |c----e3----b|
queue (pipe) cl/e1/s ----> f1/e1/r --> b1/e2/s ---> f2/e2/r --> b2/e3/s
---> wk/e3/r
cl/e1/r <---- f1/e1/s <-- b1/e2/r <--- f2/e2/s <-- b2/e3/r <--- wk/e3/s
In the "endpoint" line, "c" is for connect, "b" for bind, address is ex,
x = 1, 2, 3, transport is not specified.
In the "queue (pipe)" line, "r" is for receive, "s" for send. Each
socket has one queue for receiving and another one for sending. Queue
names are <socket>/<endpoint>/<direction: send|recv>
Is it correct regarding on what queue identifications are based inside
libzmq ?
If it is correct, then chaining proxies shall be performed as (pseudo code):
connect (c, e1) bind (f1, e1) bind (f2, e2) bind (w, e3)
connect (b1, e2) connect (b2,e3)
proxy (f1, b1) proxy (f2, b2)
Comments / corrections please, does it work like that ?
Cheers,
Laurent
Le 21/01/2014 12:32, Goswin von Brederlow a écrit :
> On Tue, Jan 21, 2014 at 11:09:54AM +0100, Laurent Alebarde wrote:
>> Hi Devs,
>>
>> This is my thuesday morning stupid question: say I have a socket on
>> which I send a message, and just after I put a receive on this same
>> socket in the code. What prevents in libzmq to receive the message I
>> have just sent ?
>>
>> Let's raise the question differently, what prevents zmq_proxy to
>> loop indefinitely since what it receives on socket A, it sends it on
>> socket B, and vice versa ?
>>
>> socket A socket B
>> | ______________________\______________________ |
>> |/ / \|
>> | |
>> |\______________________/______________________/|
>> | \ |
>> zmq_proxy(A,B)does not loop on itself like this
>>
>> Why does it manage to work like this:
>>
>> socket A socket B
>> | |
>> -->|---------------------------------------------->|------------>
>> | |
>> | |
>> <--|<----------------------------------------------|<------------
>>
>> zmq_proxy(A,B)does what it is expected to do, yeah !
> I imagine it is more like:
>
> socket A socket B
> | |
> -->| recv() -> send() |------------>
> | |
> | |
> <--| send() <- recv() |<------------
>
> Each socket has an incoming and outgoing queue. Recv() looks in the
> incoming queue and send() puts messages in the ougoing queue and never
> the two shall meet.
>
>> Can I chain: zmq_proxy(A,B); zmq_proxy(B,C), zmq_proxy(C,D),
>> assuming I start them in different threads ?
> I don't see why not.
>
>> Cheers,
>>
>>
>> Laurent
> MfG
> Goswin
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140128/daa1835b/attachment.htm>
More information about the zeromq-dev
mailing list