[rabbitmq-discuss] Question about using multi-channel

Liuzhuofu liuzhuofu at huawei.com
Fri Feb 17 06:56:00 GMT 2012


Hi all:
My application has 2 erlang processes, and runs ok now :
In process 1:
1. I connect to the mq-server and got the Connection.
2. open 2 channel by Connection at one time, I name they channel 1 and channel 2.
3. create exchange 1 by channel 2 (type : direct, durable : false)
4. create queue 1 by channel 2 (durable : false, passive : false, exclusive : false, auto_delete : true)
5. bind queue1 to exchange 1 by channel 2
6. create process 2, and subscribe queue 1 with process 2 by channel 1

In process 2:
1. when I receive a mq message, I send the basic.ack back by channel 1


My question is:
1. If in the process-1 step-6, I subscribe queue 1 with process by channel 2, when I send the basic.ack by channel 1 in process 2, it will cause the channel 1 closed. Why the channel closed if I change the subscribe channel? Must I send msg use the same channel as which I subscribe the the queue?

2. Because the two processes need to send/receive message parallelly, so I open two channels, and each process use one of the channels to send/receive message. Do I need to open two channels to let each process send/receive message by their own channel? Can I use only one channel in 2 or more erlang processes?

Regards,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120217/08f32e97/attachment.htm>


More information about the rabbitmq-discuss mailing list