<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Cheers,<br>
<br>
I was fiddling with the Topic examples and I ran into a problem. If
I start the client "ReceiveLogsTopic" before the sender
"EmitLogTopic" I see everything working fine. Sender sends and
client receives and displays right.<br>
<br>
However, if I start the sender before the client, the message gets
sent but then nothing happens, the queue appears to be empty and the
client keeps waiting for nothing.<br>
<br>
I think that's correct since the queue is created at runtime and is
destroyed when there's nothing more to do with it as explained in
the documentation:<br>
<br>
<pre class="sourcecode">channel.exchangeDeclare(<b>exchangeName</b>, <b>"direct"</b>, <b>true</b>);
String <b>queueName</b> = channel.queueDeclare().getQueue();
channel.queueBind(<b>queueName</b>, <b>exchangeName</b>, <b>routingKey</b>);</pre>
<p> This will actively declare the following objects, both of which
can be customised by using additional parameters. Here neither of
them have any special arguments. </p>
<ol>
<li>a durable, non-autodelete exchange of "direct" type</li>
<li>a non-durable, exclusive, autodelete queue with a generated
name</li>
</ol>
<br>
<br>
What I would like to do instead is (example):<br>
<br>
1)<br>
create 3 exchanges: EXA, EXB and EXC<br>
for every exchange, create 2 queues and bind them to it: Q1 and Q2.
All queues have the same name but are not the same object (see
attached PNG if needed)<br>
2)<br>
send a message to be queued in queue Q1 through EXA<br>
send the same message to be queued in queue Q1 through EXB<br>
message then is queued in two different queues which happen to have
the same name but are binded to different exchanges<br>
3)<br>
poll Q1 through EXA to read messages and delete message<br>
poll Q1 through EXB to read messages and leave message there<br>
message then is no longer in EXA-Q1 but is still available through
EXB-Q1<br>
<br>
I don't and can't know if and when someone will try to send or read
messages.<br>
<br>
I guess it would require me to declare and bind a queue beforehand,
maybe by using 3 classes: setUpExchangeAndQueues, sendMessage,
pollMessages, but I'm a bit at loss here, could anyone point me in
the right direction?<br>
<br>
I read that:<br>
<br>
If several clients want to share a queue with a well-known name,
this code would be appropriate:
<pre class="sourcecode">channel.exchangeDeclare(<b>exchangeName</b>, <b>"direct"</b>, <b>true</b>);
channel.queueDeclare(<b>queueName</b>, <b>true</b>, <b>false</b>, <b>false</b>, <b>null</b>);
channel.queueBind(<b>queueName</b>, <b>exchangeName</b>, <b>routingKey</b>);</pre>
<p> This will actively declare: </p>
<ol>
<li>a durable, non-autodelete exchange of "direct" type</li>
<li>a durable, non-exclusive, non-autodelete queue with a
well-known name</li>
</ol>
<p>Tried it but failed.</p>
Please advise, I'm going crazy on this.<br>
<br>
Thank you,<br>
<br>
have a nice day<br>
<div class="moz-signature">-- <br>
Dr. Stefano Ghio - ENG Engineering Italy<br>
<br>
Website: <a href="http://groglogs.blogspot.com/">http://groglogs.blogspot.com/</a><br>
<br>
<b>If you received this message but you are not its recipient,
please ignore it and warn me, thank you.</b></div>
</body>
</html>