qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fraser Adams <fraser.ad...@blueyonder.co.uk>
Subject Re: Creation of Request and Response quese
Date Fri, 20 Apr 2012 08:48:44 GMT
Hi Sumi,
I think that you may have misinterpreted what that thread was about, it 
didn't actually have anything to do with request/response at all (not 
sure how you inferred that really) anyway that thread related to qpid 
federation. You can federate between two brokers using a number of 
approaches (static exchange routes, dynamic exchange routes and queue 
routes) but you can't federate/link exchanges on the same broker. The 
point of that thread is that technically it's possible but qpid route 
prevents this (I commented out one line from qpid route and merrily 
connected traffic between a fanout exchange and two headers exchanges on 
the same broker).

None of that helps you of course, but I thought I'd explain.

On your particular problem, I've very much got a suspicion that you are 
digging yourself a massive hole. I've just noticed a post that you aimed 
at Robbie Gemmell you seem to have codeof this Ilk "

AMQDestination destinationQueue = new AMQQueue(exchange, routingKey,


You shouldn't really be using the low level Java Qpid code, the 
supported Java API for Qpid is JMS. Qpid is pretty JMS compliant (with a 
few quitks) and request/response code in Qpid follows standard JMS 
patterns using replyTo addresses, correlation IDs etc.

There's a good O'reilly book on JMS just called Java Message Service 
that's worth looking out for (see 
http://shop.oreilly.com/product/9780596522056.do) that has a link off to 
example code. It's worth spending a little time familiarising yourself 
with JMS (google JMS request reply or JMS request response is likely to 
be useful) I just did that and the second link could hopefully help you 
http://www.eaipatterns.com/RequestReplyJmsExample.html. This has some 
sample code that looks like a good start, though skimming through it the 
examples don't look completely self-contained.

This link looks useful too 

A basic pattern would go something like (for the case of a client making 
a request and getting a response)

     private MessageProducer _requester;
     private MessageConsumer _responder;
     private Connection      _connection;
     private Session         _syncSession;


             _syncSession = _connection.createSession(false, 

     // In the createQueue calls below obviously use your own queue 

                 // Create a MessageProducer for the QMF direct address, 
mainly used for request/response
                 Destination directAddress = 
_syncSession.createQueue("qmf." + _domain + ".direct");
                 _requester = _syncSession.createProducer(directAddress);

                 // Create the JMSReplyTo _replyAddress and MessageConsumer
                 _replyAddress = _syncSession.createQueue(_address + 
                 _responder = _syncSession.createConsumer(_replyAddress);

             MapMessage request = _syncSession.createMapMessage();
             request.setStringProperty("x-amqp-0-10.app-id", "qmf2");
             request.setStringProperty("method", "request");
             request.setStringProperty("qmf.opcode", "_query_request");
             request.setStringProperty("qpid.subject", agentName);

             // Create a QMF Query for an "SCHEMA_ID" target
             request.setObject("_what", "SCHEMA_ID");


             Message response = _responder.receive(_replyTimeout*1000);


On 19/04/12 12:01, Sumi wrote:
> Hi Frase,
> My query on Request response is very similar to you're post
> http://apache-qpid-users.2158936.n2.nabble.com/Connecting-exchanges-on-the-same-broker-tp6775844p6775844.html
> There are two exchanges already existing at AMQP broker. I need to send
> request to the Queue q binded(bk) to exchange y sends reposnse to exchange z
> Response must be an temporary queue and bound to exchange z
> Could you please tell how did you create request and response queues?????
> Thanks&  Regards
> Subha M
> --
> View this message in context: http://qpid.2158936.n2.nabble.com/Creation-of-Request-and-Response-quese-tp7479418p7480043.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org

To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org

View raw message