"So are you asking why you have to call 'createQueue' on the client side?"
--> YES!

"If I understand what you asking then calling the createQueue doesn't
create a new one if there's already on there that matches the name
you've given it, it just create the local representation of the queue
object so that when you send a message or call receive the client code
knows that you are producing or consuming on."

--> I know that no new queue will be created if there's already one on there
that matches the name you've given it, but this is just the problem: what if
I gave a WRONG name? Then a new queue (with the WRONG queue name) will be
created and messages will be sent to the WRONG queue and this is NOT what I
want.

I put some code here:

In order to send a textMessage "textA" to a queue "queueNameA", I have to do
like this:
...
f(string &queuename, string &text)
{
...
    destination = session->createQueue( queueName );
    producer = session->createProducer( destination );
    TextMessage* message = session->createTextMessage( textA );
    producer->send(message);
...
}

Then I call the function 

f("queueNameA", "textA")
There are no problem at this moment: a queue named as "queueNameA" will be
created and the message with a text "textA" will be sent to this queue. 

But next, I want to send another text "textB" to the same queue, but by
accident I write "queueNameB" in stead of "queueNameA":

f("queueNameB", "textB");

the result will be that the text "textB" will be sent to a new created queue
with name of "queueNameB"!  

What I want is to modify some code (e.g. built-in checks) in the function
f() so that when the second case happens, the function will NOT create the
wrong queue.

I hope that I am now clear to you.

Thanks

Ming




--
View this message in context: 
http://activemq.2283324.n4.nabble.com/How-to-send-a-textMessage-to-an-exising-queue-destination-tp3481137p3483807.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to