<font color="#333333"><font face="tahoma,sans-serif">Hello,</font></font><div><font color="#333333"><font face="tahoma,sans-serif"><br></font></font></div><div><font color="#333333"><font face="tahoma,sans-serif">I've done some searching but can't seem to answer a couple of questions. In the API guide, I saw:</font></font></div>
<div><font color="#333333"><font face="tahoma,sans-serif"><br></font></font></div><div><font color="#333333"><font face="tahoma,sans-serif">"</font></font><font color="#333333" face="tahoma, sans-serif">Channel instances are safe for use by multiple threads. Requests into a Channel are serialized, with only one thread being able to run a command on the Channel at a time. Even so, applications should prefer using a Channel per thread instead of sharing the same Channel across multiple threads.</font><span style="font-family:tahoma,sans-serif;color:rgb(51,51,51)">"</span></div>
<div><span style="font-family:tahoma,sans-serif;color:rgb(51,51,51)"><br></span></div><div><span style="font-family:tahoma,sans-serif;color:rgb(51,51,51)">And in the Javadocs for Channel, I saw:</span></div><div><span style="font-family:tahoma,sans-serif;color:rgb(51,51,51)"><br>
</span></div><div><span style="font-family:tahoma,sans-serif;color:rgb(51,51,51)">"</span><font color="#333333" face="tahoma, sans-serif">While a Channel can be used by multiple threads, it's important to ensure that only one thread executes a command at once. Concurrent execution of commands will likely cause an UnexpectedFrameError to be thrown.</font><span style="color:rgb(51,51,51);font-family:tahoma,sans-serif">"</span></div>
<div><span style="color:rgb(51,51,51);font-family:tahoma,sans-serif"><br></span></div><div><font color="#333333" face="tahoma, sans-serif">Currently, our service shares the same channel across each request thread and we synchronize the call to 'basicPublish'. Looking at the basicPublish code, it looks like the sequence number member variable is not thread safe but it doesn't affect us since we're not ack'ing our messages.</font></div>
<div><font color="#333333" face="tahoma, sans-serif"><br></font></div><div><font color="#333333" face="tahoma, sans-serif">My questions are:</font></div><div><font color="#333333" face="tahoma, sans-serif">1. Should we be using a channel per thread considering that we're synchronizing the basicPublish call anyway?</font></div>
<div><font color="#333333" face="tahoma, sans-serif">2. Can we just share one channel across all threads and not synchronize the call to basicPublish?</font></div><div><font color="#333333" face="tahoma, sans-serif"><br></font></div>
<div><font color="#333333" face="tahoma, sans-serif">Thanks,<br>Laurent</font></div>