[
https://issues.apache.org/jira/browse/QPID-2167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12771949#action_12771949
]
Gordon Sim commented on QPID-2167:
----------------------------------
Sorry, you did say it was an exchange in the title, I didn't read it properly!
I agree that exchangeQuery() should not throw an exception; it doesn't in my
test. The returned type (ExchangeQueryResult) has a getNotFound() method that
can be used to test whether the exchange exists or not. E.g.
#include <qpid/client/Connection.h>
#include <qpid/client/Session.h>
#include <qpid/framing/ExchangeQueryResult.h>
#include <cstdlib>
#include <iostream>
using namespace qpid::client;
using namespace qpid::sys;
using namespace qpid::framing;
using std::string;
int main(int argc, char** argv) {
std::string name = argc>1 ? argv[1] : "amq.topic";
ConnectionSettings settings;
settings.tcpNoDelay = true;
if (argc>2) settings.host = argv[2];
if (argc>3) settings.port = atoi(argv[3]);
Connection connection;
try {
connection.open(settings);
Session session = connection.newSession();
ExchangeQueryResult result = session.exchangeQuery(name);
if (result.getNotFound()) {
std::cout << name << ": does not exist" << std::endl;
} else {
std::cout << name << ": is of type " << result.getType() <<
std::endl;
}
connection.close();
return 0;
} catch(const std::exception& error) {
std::cout << error.what() << std::endl;
}
return 1;
}
> Attempting to query or declare(passive=true) a nonexistent exchange renders
> session unusable
> --------------------------------------------------------------------------------------------
>
> Key: QPID-2167
> URL: https://issues.apache.org/jira/browse/QPID-2167
> Project: Qpid
> Issue Type: Bug
> Components: C++ Client
> Affects Versions: 0.6
> Environment: Windows Server 2008
> Reporter: James Birdsall
> Fix For: 0.6
>
>
> In a program using the C++ client, running against the C++ broker, trying to
> do a session.exchangeQuery or session.exchangeDeclare (with passive=true) on
> a nonexistent exchange throws a not-found exception. Thereafter, any other
> operations on the same session throw the same exception again, including
> trying to close the session.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]