qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Moravec <pmora...@redhat.com>
Subject Re: How to know all the available topics
Date Wed, 07 Mar 2012 12:31:36 GMT
Hi Davide,
does the command:

qpid-config exchanges amq.topic -b 

fulfill your needs?

To have it implemented in a client, it is possible to invoke a QMF command to list all bindings.
Something like the C++ program below (not sure how to write the query to filter bindings from
just some exchange).

Kind regards,
Pavel


// begin of list_binginds.cpp
#include <qpid/messaging/Connection.h>
#include <qpid/messaging/Session.h>
#include <qpid/messaging/Sender.h>
#include <qpid/messaging/Receiver.h>
#include <qpid/messaging/Message.h>
#include <qpid/messaging/Address.h>

#include <iostream>

using namespace std;
using namespace qpid::messaging;
using namespace qpid::types;

int main(int argc, char** argv) {
  Connection c(argc>1?argv[1]:"localhost:5672");
  c.open();
  Session session = c.createSession();
  Receiver r = session.createReceiver("#qlister; {create:always, delete:always}");
  Sender s = session.createSender("qmf.default.direct/broker");

  Message m;
  m.setReplyTo(Address(r.getName()));
  m.setProperty("x-amqp-0-10.app-id", "qmf2");
  m.setProperty("qmf.opcode", "_query_request");

  Variant::Map request;
  request["_what"] = "OBJECT";
  Variant::Map schemaId;
  schemaId["_class_name"] = "binding";
  request["_schema_id"] = schemaId;

  encode(request, m);
  s.send(m);
  m = r.fetch(3 * Duration::SECOND);
  session.acknowledge(m);
  Variant::List response;
  decode(m, response);
  for(Variant::List::iterator iter = response.begin(); iter != response.end(); iter++) {
    Variant::Map map = iter->asMap();
    cout << map << endl;
    Variant::Map values = map["_values"].asMap();
    cout << values["name"] << endl << endl << endl;
  }
  r.close();
  s.close();
  session.close();
  c.close();
  return 0;
}
// end of list_binginds.cpp



----- Original Message -----
> From: "Davide Anastasia" <Davide.Anastasia@qualitycapital.com>
> To: users@qpid.apache.org
> Sent: Wednesday, March 7, 2012 12:11:50 PM
> Subject: How to know all the available topics
> 
> Is there a way to discover all the available topics to a certain
> exchange (let's say, amq.topic).
> 
>  
> 
> Thanks,
> 
>  
> 
> Davide Anastasia
> Analyst, Research & Development
> 
> 
> Quality Capital Management Ltd.
> QCM House * Horizon Business Village
> No. 1 Brooklands Road
> Weybridge * Surrey KT13 0TJ
> United Kingdom
> 
> Tel: +44 (0) 1932 334 400
> Fax: +44 (0) 1932 334 415
> Email: Davide.Anastasia@QualityCapital.com
> <mailto:Davide.Anastasia@QualityCapital.com>
> 
> www.qualitycapital.com <http://www.qualitycapital.com/>
> 
> ________________________________
> 
> This email and any attachments are confidential and intended solely
> for
> the use of the individual(s) to whom it is addressed.
> 
> Any views or opinions presented are solely those of the author and do
> not necessarily represent those of Quality Capital Management Ltd. If
> you are not the intended recipient, be advised that you have received
> this email in error and that any use, dissemination, printing,
> forwarding or copying of this email is strictly prohibited. Please
> contact the sender if you have received this email in error. You
> should
> also be aware that emails are susceptible to interference and you
> should
> not assume that the contents of this email originated from the sender
> above or that they have been accurately reproduced in their original
> form. Quality Capital Management Ltd is authorised and regulated by
> the
> Financial Services Authority in the UK and is a member of the
> National
> Futures Association in the US.
> 
> ________________________________
> 
>  
> 
> 

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


Mime
View raw message