[rabbitmq-discuss] 答复: Can't process_flag(trap_exit, true) in process

Liuzhuofu liuzhuofu at huawei.com
Fri Feb 10 09:59:23 GMT 2012


Hi Alex:

the process 1 follow:
process_flag(trap_exit, true),
....
...
{ok, Tag, Pid} = tcloud_mq_amqp_func:tc_subdesc_queue(ReadChannel, Que, MFA),   %% subscribe the queue with process 2 start with MFA
%% and after this code, the process 1 do nothing but wait for call/cast   process 1 is a gen_server.
%% process 1 never do unbind/delete opertion to the queue or any other thing


the process 2 follow:
loop() ->     %% loop/0 is the F of MFA that start the process 2
receive
Msg ->
io:format("Msg:~p~n", [Msg]),
loop()
end

Regard
David


________________________________________
发件人: Alexandru Scvorţov [scvalex at gmail.com] 代表 Alexandru Scvorţov [alexandru at rabbitmq.com]
发送时间: 2012年2月10日 17:38
到: Liuzhuofu
Cc: rabbitmq-discuss at lists.rabbitmq.com
主题: Re: [rabbitmq-discuss] Can't process_flag(trap_exit, true) in process

Hi David,

> I create a connection and channel in process 1, and subscribe a queue with process 2, which created by "spawn_link" in process 1, if I run "process_flag(trap_exit, true)" in process 1, the process 2 will receive a 'basic.cancel' message for the subscribe queue. If I don't run "process_flag(trap_exit, true)" in process 1, the process 2 will never receive that.

I don't follow. Are you saying that running "process_flag(trap_exit,
true)" in process 1, the queue will get deleted immediately (and hence
process 2 will receive a basic.cancel)?

Could you post your code please?

Cheers,
Alex

On Fri, Feb 10, 2012 at 08:22:10AM +0000, Liuzhuofu wrote:
> Hi all:
> I found a strange thing:
> I create a connection and channel in process 1, and subscribe a queue with process 2, which created by "spawn_link" in process 1, if I run "process_flag(trap_exit, true)" in process 1, the process 2 will receive a 'basic.cancel' message for the subscribe queue. If I don't run "process_flag(trap_exit, true)" in process 1, the process 2 will never receive that.
> Why ?
>
> Regards,
> David

> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120210/3e76fa01/attachment.htm>


More information about the rabbitmq-discuss mailing list