On 03/22/2011 01:24 PM, Toralf Lund wrote:
The documentation of qpid::messaging::Session::close() says:
close <cid:[email protected]> () Closes a session and all
associated senders and receivers.
But, if I do something like:
qpid::messaging::Session session=connection.createSession();
qpid::messaging::Receiver receiver=session.createReceiver("someaddress");
session.close();
then check receiver.isClosed(), i actually get "false". Which leads to
the question in the subject...
Does anyone know more about this?
Do you have a reproducer? A simple test (as attached) works for me
(albeit on the latest from trunk). Does this work for you?
#include <iostream>
#include <string>
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
#include <qpid/messaging/Connection.h>
#include <qpid/messaging/Session.h>
#include <qpid/messaging/Message.h>
#include <qpid/messaging/Sender.h>
#include <qpid/messaging/Receiver.h>
#include <qpid/messaging/exceptions.h>
using namespace qpid::messaging;
int main(int argc, char** argv)
{
std::string address = argc>1 ? argv[1] : "amq.topic";
std::string host = argc>2 ? argv[2] : "127.0.0.1";
try {
Connection conn(host);
conn.open();
Session session = conn.createSession();
Receiver receiver;
try {
receiver = session.createReceiver(address);
} catch (ResolutionError& e) {
std::cerr << "Failed to resolve source address: " << e.what() << std::endl;
}
if (!session.hasError()) {
session.close();
std::cout << "Session closed" << std::endl;
} else {
std::cout << "Session is invalid" << std::endl;
}
std::cout << "Receiver is ";
if (receiver.isNull()) std::cout << "null";
else if (receiver.isClosed()) std::cout << "closed";
else std::cout << "open";
std::cout << std::endl;
conn.close();
} catch(std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
}
return 0;
}
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]