On 28/02/17 21:10, mottese wrote:
Do you know how I would obtain the incoming links?
Basically you just do a query where the _class_name is 'incoming' (probably similar to what you do for queues, but with a different type?).
Attached is a simple example that prints a count of the number of (AMQP 1.0 based) sender links by target address.
/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ #include <qpid/messaging/Address.h> #include <qpid/messaging/Connection.h> #include <qpid/messaging/Message.h> #include <qpid/messaging/Receiver.h> #include <qpid/messaging/Sender.h> #include <qpid/messaging/Session.h> #include <qpid/types/Variant.h> #include <iostream> using namespace qpid::messaging; using namespace qpid::types; using std::string; int main(int argc, char** argv) { Connection c(argc > 1 ? argv[1] : "localhost", "{protocol:amqp1.0}"); try { c.open(); Session session = c.createSession(); Receiver r = session.createReceiver("#"); Sender s = session.createSender("qmf.default.direct/broker"); Message request; request.setReplyTo(r.getAddress()); request.setProperty("x-amqp-0-10.app-id", "qmf2"); request.setProperty("qmf.opcode", "_query_request"); Variant::Map schemaId; schemaId["_class_name"] = "incoming"; Variant::Map content; content["_what"] = "OBJECT"; content["_schema_id"] = schemaId; request.setContentObject(content); s.send(request); std::map<std::string, size_t> counts; Message response = r.fetch(); Variant::List contentIn = response.getContentObject().asList(); for (Variant::List::const_iterator i = contentIn.begin(); i != contentIn.end(); ++i) { Variant::Map item = i->asMap(); counts[item["_values"].asMap()["target"]]++; } for (std::map<std::string, size_t>::const_iterator i = counts.begin(); i != counts.end(); ++i) { std::cout << i->first << ": " << i->second << std::endl; } session.acknowledge(); } catch(const std::exception& error) { std::cout << "ERROR: " << error.what() << std::endl; } c.close(); return 0; }
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org For additional commands, e-mail: users-h...@qpid.apache.org