<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;"><font class="Apple-style-span" size="4">Hi all:</font>
<div><span class="Apple-tab-span" style="white-space:pre"></span><font class="Apple-style-span" size="4">My application has 2 erlang processes, and runs ok now :</font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span><b>I</b></font><font class="Apple-style-span" size="4"><b>n process 1:</b>&nbsp;&nbsp;</font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span>1.&nbsp;I connect to the mq-server and got the Connection.</font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span>2. open 2 channel by Connection at one time, I name they channel 1 and channel 2.</font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span>3. create exchange 1 by channel 2 (type : direct, durable : false)</font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span>4. create queue 1 by channel 2 (durable : false, passive : false, exclusive : false, auto_delete : true)</font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span>5. bind queue1 to exchange 1 by channel 2</font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span>6. create process 2, and subscribe queue 1 with process 2 by channel 1</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span><b>In process 2:</b></font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span>1. when I receive a mq message, I send the basic.ack back by channel 1&nbsp;</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span>My question is:</font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span>1. If in the process-1 step-6, I subscribe queue 1 with process by
<font class="Apple-style-span" color="#ff0000">channel 2</font>, when I send the basic.ack by channel 1 in process 2, it will cause the
<font class="Apple-style-span" color="#ff0000">channel 1 closed</font>. 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?</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4"><span class="Apple-tab-span" style="white-space:pre"></span>2. Because the two processes need to send/receive message&nbsp;parallelly, so I open two channels, and each process use one of the channels to send</font>/receive<span class="Apple-style-span" style="font-size: large; ">&nbsp;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?</span></div>
<div><span class="Apple-style-span" style="font-size: large; "><br>
</span></div>
<div><span class="Apple-style-span" style="font-size: large; ">Regards,</span></div>
<div><span class="Apple-style-span" style="font-size: large; ">David</span></div>
<div></div>
<div></div>
</div>
</body>
</html>