On 05/02/2014 12:23 PM, An Yang wrote:
Hi all,

I'm using CentOS 6.5, and write a demo program with C++0x thread, it should
create sender and receiver thread, but I got the followings:
$g++ -std=c++0x -pthread qpid-thread.cpp  -o qpid-thread -lqpidmessaging
qpid-thread.cpp: In function 'void qpid::tests::qpidReceive()':
qpid-thread.cpp:27: error: no matching function for call to
'qpid::messaging::Receiver::fetch(qpid::messaging::Message&, int)'
/usr/include/qpid/messaging/Receiver.h:78: note: candidates are: bool
qpid::messaging::Receiver::fetch(qpid::messaging::Message&,
qpid::messaging::Duration)
/usr/include/qpid/messaging/Receiver.h:90: note:
qpid::messaging::Message
qpid::messaging::Receiver::fetch(qpid::messaging::Duration)

You need to pass a qpid::messaging::Duration object as the second parameter to fetch(), e.g.

Connection connection;
try {
     connection = Connection("ampq:tcp:localhost");
     connection.open();
     Session session = connection.createSession();
     Receiver receiver = session.createReceiver("benchmark");
     receiver.setCapacity(1000);
     Message msg;
     if (receiver.fetch(msg, 0))
         std::cout << "got a message" << std::endl;

  if (receiver.fetch(qpid::messaging::Duration::IMMEDIATE)


     session.commit();
     session.acknowledge();
     session.close();
     connection.close();
     } catch(const std::exception& error) {
         std::cerr << "qpid-receive: " << error.what() << std::endl;
         connection.close();
     }
}



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

Reply via email to