On 05/21/2013 10:35 AM, Christian Fromme wrote:
Is there an exhaustive list of exceptions/error codes and what they
mean? I've looked in the QMF Map Message Protocol[0], but didn't find
it there.

Also, a list of requests (types?) would be very handy. (Requesting a
list of existing bridges, for instance.)

Sorry, unfortunately there is really not much in the way of documentation on QMF beyond the description you list below.

To get a list of objects of a particular class you set the qmf op code to '_query_request' (as opposed to _method_request' for method invocations). You then set the body of the map message to contain a query, which in this case is a nested map keyed on '_schema_id' that itself has the '_class_name' set to the class of interest (bridge, link, queue, exchange etc).

Attached is a little example that hopefully helps illustrate what I mean.


[0]  https://cwiki.apache.org/qpid/qmf-map-message-protocol.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


/*
 *
 * 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");
    try {
        c.open();
        Session session = c.createSession();
        Address responses("#; {create: always, node: {x-declare: {auto-delete:True}}}");
        Receiver r = session.createReceiver(responses);
        Sender s = session.createSender("qmf.default.direct/broker");

    	Message request;
        request.setReplyTo(responses);
        request.setContentType("amqp/map");
        request.setProperty("x-amqp-0-10.app-id", "qmf2");
        request.setProperty("qmf.opcode", "_query_request");
        Variant::Map schemaId;
        schemaId["_class_name"] = "bridge";
        Variant::Map content;
        content["_what"] = "OBJECT";
        content["_schema_id"] = schemaId;

        encode(content, request);
        s.send(request);
        Message response = r.fetch();
        Variant::List contentIn;
        decode(response, contentIn);
        for (Variant::List::const_iterator i = contentIn.begin(); i != contentIn.end(); ++i) {
            Variant::Map item = i->asMap();
            std::cout << item["_values"] << std::endl;
        }
        session.acknowledge();
    } catch(const std::exception& error) {
        std::cout << "ERROR: " << error.what() << std::endl;
    }
    c.close();
    return 0;
}



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to