[rabbitmq-discuss] Channel takes everyone down?
Alexandru Scvorţov
alexandru at rabbitmq.com
Wed Jul 20 22:00:09 BST 2011
Hi James,
> However, when a consumer has a non-normal exit, the channel goes down,
> but the exit signal bubbles up all the way to where *all* other channels
> go down as well.
I've just tried it and you're right: sending a non-normal exit to a
channel will cause the connection to go down, taking all the other
channels with it.
For what it's worth, this also happens with 2.5.1 and we don't have any
plans to change this behaviour right now. It happens because channels
don't trap exits.
I'm afraid there isn't anyway to do it automatically. You could start
a separate process that traps exits and is linked to your consumer.
When you receive an exit from the consumer, close its channel cleanly.
So, a very basic supervisor.
Maybe something like this:
https://gist.github.com/1095910
Run() is what I think you're doing. Run2() starts up a separate thread
to monitor the consumer and close its channel when the time comes.
That's 2.5.1 code, btw: the parameters for connection:open/1 changed a
bit.
Hope this helps.
Cheers,
Alex
On Tue, Jul 19, 2011 at 02:20:59PM -0700, James Aimonetti wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> My setup is as follows: I have a channel per consumer, and I'm trying to
> link the consumer to the channel so that if either dies, the other goes
> down (most consumers are ephemeral and easy to restart, those that are
> longer living trap exits).
>
> However, when a consumer has a non-normal exit, the channel goes down,
> but the exit signal bubbles up all the way to where *all* other channels
> go down as well.
>
> Any pointers how to link a consumer to its channel without taking the
> whole tree of channels down?
>
> This is with rabbitmq server and erlang-client 2.4.1 and r14b03.
>
> Thanks!
>
> James
>
> - --
> James Aimonetti
> Distributed Systems Engineer / DJ MC_
>
> 2600hz | http://2600hz.com
> sip:james at 2600hz.com
> tel: 415.886.7905
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJOJfU6AAoJENc77s1OYoGg/LoH/jIA8jdA7nUsZC+hbTstmkxv
> RkYg05yyB2qMp5yvoE54NL7U7LjpM6DZtCGrubbva5s9bYpRvQgQrO6XbAV17bTV
> nEyY+31L2IpAxX2hFOjIpMqiQ85iMlXZ+zzHnQ5vnaKlxPuhlpgRdaMdX/0ca+8W
> cMZF/FkNcX9Trwsz+XmOdKdKK0ctzZ7N4T6/5aIPzpObGBGuvZQG+b62txYf3x6Y
> 5Y0vPXlIDcQrU9yZ7osSG9q2DuW6qzDL9zMBZ8M8UwZoDhLRUw4DxZO3PnI+FZJz
> npJcpMeQXNopE6K1idEkFfVmB+XBgcS3a9FGlruuhiBrMLWWmpjpKBJaZ+CRPFU=
> =/7L/
> -----END PGP SIGNATURE-----
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
More information about the rabbitmq-discuss
mailing list