[rabbitmq-discuss] Catching channel disconnect

Valentino Volonghi dialtone at gmail.com
Tue Oct 14 22:23:58 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey,
I'm using the erlang client and I need to detect when one of my channels
disconnects, from my crash report I see that:

=CRASH REPORT==== 14-Oct-2008::12:22:59 ===
   crasher:
     pid: <0.155.0>
     registered_name: []
     exception exit: {function_clause,
                         [{amqp_channel,handle_info,
                              [{'EXIT',<0.157.0>,normal},
                               {channel_state, 
1,<0.151.0>,<0.153.0>,<0.156.0>,
                                   #Fun<amqp_network_driver.do.2>,
                                   #Fun<amqp_network_driver.do.3>,
                                    
#Fun<amqp_network_driver.close_channel.1>,

what happens is that this function is called:

handle_info( {'EXIT', Pid, normal}, State) ->
     NewState = unregister_channel(Pid, State),
     {noreply, NewState};

Which unregisters the channel. Unfortunately I don't understand how to  
setup the
system so that it reconnects or that it crashes if the channel goes  
down.

I have a supervisor that is configured in this way:

    ...

     {ok, RemoteHost} = application:get_env(server, remote_host),
     {ok, Tsize} = application:get_env(server, t_size),

     Shovel = {shovel,
         {shovel, start, [RemoteHost, Tsize]},
         permanent, 5000, worker, [shovel]
     },

     Processes = [Shovel, EGeoIp, ShareServer, Web],
     {ok, {{one_for_one, 10, 10}, Processes}}.


While the shovel.erl file is here:
http://github.com/dialtone/shovel/tree/master/src/shovel.erl

This all works fine until I shut down the remote host, then shovel  
crashes
and I can't see how to recover it.

I'd also would be grateful if anyone could point me to a good OTP  
documentation
where good means that it explains how everything fits together rather  
than simply
how I can configure stuff here and there (as done in programming  
erlang).

I'm basically a bit clueless as to how to proceed without changing the  
client's
source code.

- --
Valentino Volonghi aka Dialtone
Now running MacOS X 10.5
Home Page: http://www.twisted.it
http://www.adroll.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iEYEARECAAYFAkj1De4ACgkQ9Llz28widGUF7gCghtBZ/HcLsz9EoQuv/raUJgAI
WysAnRIZT+18OjmN27BBYskFMYI18/oL
=Vx8d
-----END PGP SIGNATURE-----




More information about the rabbitmq-discuss mailing list