<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt">Based on Ben and Alexis's discussion, I came up with the following logic. Let me know if you guys see any flaw in it. I use two exchanges; one for one-to-one chat and another for multi-user chat. Clients will use Java. I create one queue per user. Effectively, there will be two queues per chat. <br><br><br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CMRAMAM%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</xml><![endif]--><style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
        {mso-style-name:"Table Normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0in 5.4pt 0in 5.4pt;
        mso-para-margin:0in;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";
        mso-ansi-language:#0400;
        mso-fareast-language:#0400;
        mso-bidi-language:#0400;}
</style>
<![endif]-->
<p class="MsoNormal"><b style=""><u>One-to-one chat:<o:p></o:p></u></b></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When the user wants to send the message use SimpleProducer
class. For every 10 seconds, run SimpleConsumer class to see if there are any
messages in the queue.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><u>SimpleProducer:<o:p></o:p></u></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Publish the message in the window with the user’s name </p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Connect to channel</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Declare exchange named “direct”</p>
<p class="MsoNormal">Create queuename equivalent to the friend’s user name. </p>
<p class="MsoNormal">Routing key is the same as the queuename.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Do channel..basicPublish to publish the message to the
friend.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If message is not acknowledged, show error as
“<friendname> is offline”.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><u>SimpleConsumer:<o:p></o:p></u></p>
<p class="MsoNormal"><u><o:p><span style="text-decoration: none;"><br></span></o:p></u></p>
<p class="MsoNormal">Set noAck to false</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Do channel.basicGet for the queuename “<username>”</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If message is received successfully, do channel.basicAck to
acknowledge the receipt of the message.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Publish the incoming message with the friend’s name</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b style=""><u>Multi-user chat:<o:p></o:p></u></b></p>
<p class="MsoNormal">When the user wants to send the message use
SimpleProducerMulti class. For every 10 seconds, run SimpleConsumerMulti class
to see if there are any messages in the queue.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><u>SimpleProducerMulti:<o:p></o:p></u></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Connect to channel</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Declare exchange named “multiuser”</p>
<p class="MsoNormal">Create queuename as “multiuserqueue”</p>
<p class="MsoNormal">Routing key is the same as the queuename.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Do channel.basicPublish to publish the message to
multiuserqueue.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If message is not acknowledged, show error as “server is
offline”.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><u>SimpleConsumerMulti:<o:p></o:p></u></p>
<p class="MsoNormal"><u><o:p><span style="text-decoration: none;"><br></span></o:p></u></p>
<p class="MsoNormal">Set noAck to false</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Use QueueingConsumer class </p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Do channel.basicConsume for the queuename “<username>”</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If message is received successfully, do channel.basicAck to
acknowledge the receipt of the message.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Publish the incoming message with the author’s name.</p>
<br><br>-- Thanks, Ram<br></div><br>
</body></html>