[zeromq-dev] ZeroMQ 2.0 reconnect question

Martin Sustrik sustrik at 250bpm.com
Mon Dec 14 22:22:10 CET 2009

Hi James,

Lobraco, James M wrote:
> I created a two simple pub/sub applications using 2.0. Everything works
> fine, however, if I shut the publisher down, then start it back up, the
> original subscriber does not reconnect with the new publisher. I tried
> setting the identity option on the socket with on the publisher with no
> luck. 
> I did notice in zmq_connector_init.cpp the following comment in detch().
> Is this just not supported in 2.0 yet?
> void zmq::zmq_connecter_init_t::detach ()
> {    //  TODO: Start reconnection process here.
> /*
>     //  Create a connecter object to attempt reconnect. Ask it to wait
> for a
>     //  while before reconnecting.
>     io_thread_t *io_thread = choose_io_thread (options.affinity);
>     zmq_connecter_t *connecter = new zmq_connecter_t (io_thread, owner,
>         options, session_name.c_str (), true);
>     connecter->set_address (...);
>     zmq_assert (connecter);
>     send_plug (connecter);
>     send_own (owner, connecter);
> */
>     //  This function is called by engine when disconnection occurs.
>     //  The engine will destroy itself, so we just drop the pointer here
> and
>     //  start termination of the init object.
>     engine = NULL;
>     term ();
> } 

Yes. You've found the guilty piece of the code :)

Version 2.0 is in alpha, so there are still some pieces unfinished. I 
can get the reconnection code into the trunk, but I'll need someone to 
test it thoroughly. Would you be willing to help with that?


More information about the zeromq-dev mailing list