summaryrefslogtreecommitdiff
path: root/qpid/cpp/examples
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2009-06-08 20:23:19 +0000
committerTed Ross <tross@apache.org>2009-06-08 20:23:19 +0000
commit1c81b58b55074bc233c2d887ce77576ef075a0d1 (patch)
treef7702e19ea38aa99b060c8f0ef56993639d333c4 /qpid/cpp/examples
parent3d97b2b959504ad4933cc1ddc6974a7bdf8457ea (diff)
downloadqpid-python-1c81b58b55074bc233c2d887ce77576ef075a0d1.tar.gz
Bugfixes in the c++ console API:
- Connection threads now shut down cleanly - get-query timeouts now work properly - waitForStable now only waits for connected brokers The ping example was improved. It now more cleanly handles connection loss/reconnect. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@782766 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/examples')
-rw-r--r--qpid/cpp/examples/qmf-console/ping.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/qpid/cpp/examples/qmf-console/ping.cpp b/qpid/cpp/examples/qmf-console/ping.cpp
index 39ec0d3039..405c15f1c4 100644
--- a/qpid/cpp/examples/qmf-console/ping.cpp
+++ b/qpid/cpp/examples/qmf-console/ping.cpp
@@ -43,6 +43,7 @@ int main_int(int /*argc*/, char** /*argv*/)
//
SessionManager::Settings smSettings;
smSettings.methodTimeout = 2;
+ smSettings.getTimeout = 2;
//
// Declare the console session manager. With a null listener argument, it defaults to
@@ -58,18 +59,21 @@ int main_int(int /*argc*/, char** /*argv*/)
uint32_t count = 5; // The number of echo requests we will send to the broker.
Object::Vector list; // A container for holding objects retrieved from the broker.
- //
- // Query for a list of 'broker' objects from the Management Database
- //
- sm.getObjects(list, "broker");
+ for (uint32_t iter = 0; iter < count; iter++) {
+ cout << "Ping Broker: " << broker->getUrl() << "... ";
+ cout.flush();
- //
- // We expect one object (since we are connected to only one broker)
- //
- if (list.size() == 1) {
- Object& brokerObject = *(list.begin());
+ //
+ // Query for a list of 'broker' objects from the Management Database
+ //
+ sm.getObjects(list, "broker");
+
+ //
+ // We expect one object (since we are connected to only one broker)
+ //
+ if (list.size() == 1) {
+ Object& brokerObject = *(list.begin());
- for (uint32_t iter = 0; iter < count; iter++) {
//
// Declare a container for arguments to be sent with the "echo" method
// that we will invoke on the remote "broker" object.
@@ -87,9 +91,6 @@ int main_int(int /*argc*/, char** /*argv*/)
args.addUint("sequence", iter);
args.addString("body", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- cout << "Ping Broker: " << broker->getUrl() << "... ";
- cout.flush();
-
//
// Invoke the method. This is a synchronous operation that will block until
// the method completes and returns a result.
@@ -109,6 +110,9 @@ int main_int(int /*argc*/, char** /*argv*/)
if (result.code == 0 && iter < count - 1)
qpid::sys::sleep(1);
+ } else {
+ cout << "Disconnected..." << endl;
+ qpid::sys::sleep(1);
}
}