Hi David,
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?
Yes, acks are local to the channel the broker sent them on. In other
words, you need to ack on the same channel you did the
basic.get/basic.consume.
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?
It would be better if you didn't share channels between processes. If
you do use a channel on multiple processes, it will probably not cause
an error, but some things might not work as you expect them to.

Channels are very cheap, btw. There's no harm in using a lot of them.

Cheers,
Alex
On Fri, Feb 17, 2012 at 06:56:00AM +0000, Liuzhuofu wrote:
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
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedFeb 17, '12 at 6:56a
activeFeb 17, '12 at 1:11p
posts2
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

Alexandru Scvorţov: 1 post Liuzhuofu: 1 post

People

Translate

site design / logo © 2018 Grokbase