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 messenger -> qpidd replyTo shenanigans.....
Date Sat, 26 Jul 2014 15:05:04 GMT
Hey all,
I'm currently messing around writing some examples for the JavaScript 
bindings and I figured that it would be a good laugh to do a QMF2 
example cause, that would illustrate a few use cases in one go.

My basic hacky starter for ten is nearly there (pasted below) it runs in 
node.js and uses a WebSocket -> TCP socket proxy to talk to qpidd.

The only bit I'm a bit stuck on is getting the reply-to to work properly.

I based it on the python client/server messenger example, which had a 
replyTo = '~/replies'; and didn't need the client to explicitly call 
subscribe in order to receive the response message. However If I just do 
that I get:

CONNECTION ERROR (amqp:internal-error) not-found: Exchange not found: 

So qpidd is clearly not amused by that. I don't *really* understand 
Messenger replyTo - the "~" seems to be the Messenger name (in the 
client/server code it seems to be printing <UUID>/replies) but qpidd 
seems to require a Node name as a replyTo.

As normal for QMF I want a dynamic reply address/queue, which I can get 
if I do.

var subscription = messenger.subscribe('amqp://');

However I don't know how to find the name of the queue thus created at 
run time that I can use to populate the replyTo?

my subscribe returns the subscription but my subscription.getAddress(); 
just returns an empty string - it could be an issue with my 
implementation but I don't think so as it's just a thin wrapper round 
pn_messenger_subscribe and pn_subscription_address.

If I use a named queue (e.g. test) and set the replyTo to "test" and 
messenger.subscribe('amqp://'); then I get the list of 
QMF queue objects printed out, which is what I want, so the only issue 
that I have really is not understanding how to do dynamic replyTo 
addresses from Messenger to qpidd.

The JavaScript code is copied below using the "test" queue.

I'd love to know how to use a proper dynamic replyTo for this.


proton = require("qpid-proton");

var address = 'amqp://';
var subject = 'broker';
//var replyTo = '~/replies';
var replyTo = 'test';
var tracker = null;
var running = true;

var message = new proton.Message();
var messenger = new proton.Messenger();

var pumpData = function() {
     while (messenger.incoming()) {
         var t = messenger.get(message);

         // data is the body as a proton.Data Object, used in this case 
         // format() returns exactly the same representation as recv.c
         console.log("Content: " + message.data.format());


     if (messenger.isStopped()) {

messenger.on('error', function(error) {console.log(error);});
messenger.on('work', pumpData);

message.properties = {
     "x-amqp-0-10.app-id": "qmf2",
     "method": "request",
     "qmf.opcode": "_query_request",
message.body = {
     "_what": "OBJECT",
     "_schema_id": {
         "_package_name": "org.apache.qpid.broker",
         "_class_name": "queue"

tracker = messenger.put(message);


messenger.recv(); // Receive as many messages as messenger can buffer.

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

View raw message