Re: [mongrel2] Examples of Handlers with a non-empty recv_ident
- From:
- Matthew King
- Date:
- 2011-09-02 @ 00:30
On Thu, Sep 1, 2011 at 3:06 PM, Michael Granger <ged@faeriemud.org> wrote:
> Does anyone have an example of a Handler with a non-empty recv_ident? Or
> what it means for the receive socket to "subscribe to its messages" as
> described in the manual?
snout = Handler(
# PUSH
send_spec='tcp://192.168.222.242:15001',
send_ident='CFC368AB-5129-40C3-BCAE-0613FBC82D8C',
# SUB
recv_spec='tcp://192.168.222.242:15002',
recv_ident='CFC368AB-5129-40C3-BCAE-0613FBC82D8C'
)
Relevant section of the manual says:
recv_ident: This is another UUID if you want the receive socket to
subscribe to its messages. Handlers properly mention the send_ident on
all returned messages, so you should either set this to nothing and
don’t subscribe, or set it to the same as send_ident.
If you do not set a recv_ident, Mongrel2 will try to handle all
responses it receives on its SUB socket. If you're only running one
Mongrel2 server, this doesn't matter. If you've got multiple Mongrel2
servers running, however, and your handlers' PUB sockets are connected
to both Mongrel2 SUB sockets, then all the Mongrels will try to handle
the response.
So far as I can tell, this means that all the Mongrel2 servers which
are NOT holding onto the original HTTP request will complain into
their error.logs that they couldn't find an fd corresponding to the
response conn_id.
Re: [mongrel2] Examples of Handlers with a non-empty recv_ident
- From:
- Yaroslav Shirokov
- Date:
- 2011-09-02 @ 00:37
Mongrel2 will subscribe (http://api.zeromq.org/2-1:zmq-setsockopt
ZMQ_SUBSCRIBE) to the ident you give it on its SUB socket, so any messages
that arrive on the socket without a matching UUID will get silently
dropped by ZMQ and mongrel2 will never see it.
The default of "" is ZMQ for "subscribe to all of the things"
--
Slava
On Sep 1, 2011, at 8:30 PM, Matthew King wrote:
> So far as I can tell, this means that all the Mongrel2 servers which
> are NOT holding onto the original HTTP request will complain into
> their error.logs that they couldn't find an fd corresponding to the
> response conn_id.
Re: [mongrel2] Examples of Handlers with a non-empty recv_ident
- From:
- Matthew King
- Date:
- 2011-09-02 @ 00:31
Whoops, forgot to clarify which part was the manual and which was me.
My explanation begins with "If you do not set a recv_ident".