You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by rinkeshmodi <ri...@gmail.com> on 2011/03/02 15:58:05 UTC
acknowledgement message not going out of queue after being consumed
Hi,
I am using the request response example of java client. Instead of using
temporary queue in Client I have used a queue defined in vitualhosts.xml for
receiving acknowledgements from Server.
But after the server has sent the acknowledgement, the Client recieves it
and consumes it. But in JMX management console i can still see the message
present in the queue.
Below is code for Client:
connection = ((ConnectionFactory)
lookupJNDI(CONNECTION_JNDI_NAME)).createConnection();
session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Destination requestQueue = (Queue) lookupJNDI(QUEUE_JNDI_NAME);
closeJNDI();
//Setup a message _producer to send message to the queue the
server is consuming from
_producer = session.createProducer(requestQueue);
//Create a queue that this client will listen for responses on
then create a consumer
//that consumes message from this queue.
responseQueue =
session.createQueue("direct://amq.direct/queue");
MessageConsumer responseConsumer =
session.createConsumer(responseQueue);
//Set a listener to asynchronously deal with responses.
responseConsumer.setMessageListener(this);
// Now the connection is setup up start it.
connection.start();
}
catch (JMSException e)
{
System.err.println("Unable to setup connection, client and
producer on broker");
return;
}
// Setup the message to send
TextMessage txtMessage;
try
{
//Now create the actual message you want to send
txtMessage = session.createTextMessage("Request Process");
//Set the reply to field to the temp queue you created above,
this is the queue the server will respond to
txtMessage.setJMSReplyTo(responseQueue);
Please let me know if the creation of queue is correct?
thanks,
rinkesh
--
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/acknowledgement-message-not-going-out-of-queue-after-being-consumed-tp6081231p6081231.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org