qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duong Quynh (FSU1.Z8.IP)" <Quyn...@fsoft.com.vn>
Subject Potential qpid cpp 0.28 bug
Date Fri, 04 Jul 2014 07:05:05 GMT
Hi everyone,

Today while coding a simple sender on qpid cpp 0.28 I encountered a problem where the program
will not quit after completing its task. I am building using g++ 4.8.3, boost 1.49.0, proton
0.70 to name a  few. I put the program through gdb and it seems to jump around infitely after
the std::cout << "2" << endl; line. My current guess is Sender class has issues
since the receiver I wrote would quit gracefully.

Please see the code below:

//C++ producer code starts

#include <qpid/messaging/Connection.h>

#include <qpid/messaging/Message.h>

#include <qpid/messaging/Message_io.h>

#include <qpid/messaging/Sender.h>

#include <qpid/messaging/Session.h>

#include <iostream>

using namespace qpid::messaging;

int main(int argc, char** argv) {
    Connection connection;
    try
    {
        std::string url = argc > 1 ? argv[1] : "localhost:5672";
        std::string address = argc > 2 ? argv[2] : "'topic://usa.news'";

        std::string connectionOptions = argc > 3 ? argv[3] : "{username:guest,password:guest,sasl_mechanisms:PLAIN,protocol:amqp1.0}";

        connection = Connection(url, connectionOptions);
        connection.open();

        std::cout << "1" << std::endl;
        Session session = connection.createSession();
        Sender sender = session.createSender(address);

        int count = 10;

        for (int i = 0; i < count; i++)
        {
            sender.send(Message("Hello news!"));
            std::cout << "Sent - Hello news! " << i << std::endl;
        }

        std::cout << "2" << std::endl; // program seems to have problem after
this point

        session.close();

        connection.close();

        return 0;
    } catch (const std::exception& error) {
        std::cout << "Error: " << error.what() << std::endl;
        connection.close();
    }
    return 1;
} //C++ code ends

Q

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message