You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by trivedi_ravi13 <tr...@yahoo.co.in> on 2019/03/01 09:53:44 UTC

Re: Client to broker connection status using C++ API

Hi Gordan,

   I am using following code to get the list of connections. However, I
found it gives me only first 100 connections. When I use "qpid-stat" it
shows me all the connections even beyond 100. What's wrong with this code?

int main(int argc, char** argv)
{

    Connection c("127.0.0.1:5672");

    try {
        c.open();
        Session session = c.createSession();
        Address
responses("qmf.default.topic/direct.amqpagent;{node:{type:topic},
link:{x-declare:{auto-delete:True,exclusive:True}}}");
        Receiver r = session.createReceiver(responses);
        Sender s = session.createSender("qmf.default.direct/broker");

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

        encode(content, request);
        s.send(request);
        Message response = r.fetch();
        Variant::List contentIn;
        decode(response, contentIn);

        for(Variant::List::iterator it = contentIn.begin(); it !=
contentIn.end(); it++) {
            Variant::Map details = it->asMap()["_values"].asMap();
            std::cout << details << std::endl;
        }

        session.acknowledge();

    } catch(const std::exception& error) {
        std::cout << "ERROR: " << error.what() << std::endl;
    }

    c.close();
    return 0;
}




--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: Client to broker connection status using C++ API

Posted by trivedi_ravi13 <tr...@yahoo.co.in>.
Yes it's indeed fragmented. One message contains 100 records. It worked after
handling "partial". Thank you.



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: Client to broker connection status using C++ API

Posted by Gordon Sim <gs...@redhat.com>.
On 01/03/2019 9:53 am, trivedi_ravi13 wrote:
> Hi Gordan,
> 
>     I am using following code to get the list of connections. However, I
> found it gives me only first 100 connections. When I use "qpid-stat" it
> shows me all the connections even beyond 100. What's wrong with this code?

If there is a lot of data, it may be sent back in multiple response 
messages (though 100 seems rather low to be triggering that on the 
normal frame size). Check whether the response has the 'partial' 
property set, and if so keep fetching another response until it does not.

You can also compare the protocol traces for qpid-stat and your code.


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