Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 316158 Details for
Bug 461572
Simpler examples in the Tutorial
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
simple qpid client
bz453598.cpp (text/plain), 3.96 KB, created by
David Sommerseth
on 2008-09-09 08:34:35 UTC
(
hide
)
Description:
simple qpid client
Filename:
MIME Type:
Creator:
David Sommerseth
Created:
2008-09-09 08:34:35 UTC
Size:
3.96 KB
patch
obsolete
>/* bz453598.cpp - Checks if this bugzilla is closed or not. > * > * BZ subject: Return null from SubscriptionManager::get() if there is no message > * > * This program will try to call the SubscriptionManager::get() under different conditions > * to see if the call blocks, or returns NULL. If all tests are OK, the program will > * exit with 0, if not it returns with 1. > * > * Author: David Sommerseth <davids@redhat.com> 2008-09-08 > * > * Copyright (c) 2008 Red Hat, Inc. All rights reserved. This copyrighted material > * is made available to anyone wishing to use, modify, copy, or > * redistribute it subject to the terms and conditions of the GNU General > * Public License v.2. > * > * This program is distributed in the hope that it will be useful, but WITHOUT ANY > * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A > * PARTICULAR PURPOSE. See the GNU General Public License for more details. > * > * You should have received a copy of the GNU General Public License > * along with this program; if not, write to the Free Software > * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. > * > */ > >#include <qpid/client/AsyncSession.h> >#include <qpid/client/Dispatcher.h> >#include <qpid/client/Connection.h> >#include <qpid/client/Session.h> >#include <qpid/client/Message.h> >#include <qpid/client/MessageListener.h> >#include <qpid/client/SubscriptionManager.h> > > >#include <stdio.h> >#include <signal.h> >#include <unistd.h> >#include <cstdlib> >#include <iostream> >#include <sstream> > >using namespace qpid::client; >using namespace qpid::framing; >using namespace std; > >void timeout_handler(int sig) { > cerr << "Caught a timeout - test failed" << endl; > exit(1); >} > >int main(int argc, char **argv) { > int ret = 1; > try { > if( argc != 3 ) { > cout << "Usage: " << argv[0] << " <broker host> <broker port>" << endl; > return 1; > } > > // Connect to the broker > Connection connection; > connection.open(argv[1], atoi(argv[2])); > > // Start a new session > Session session = connection.newSession(); > LocalQueue queue; > Message received; > > // Create a queue for our test > session.queueDeclare(arg::queue="bz453598_queue", arg::exclusive=true, arg::autoDelete=true); > SubscriptionManager subscr(session); > > // Prepare a timeout handler - all 3 tests gets 1 minute to complete > signal(SIGALRM, timeout_handler); > alarm(60); > > // > // Do the tests > // > > cout << "Testing if SubscriptionManager::get() blocks on empty queue ... "; > cout << " returns " << subscr.get(received, "bz453598_queue") << " - TEST PASS" << endl; > > string data("Testing bz453598!"); > cout << "Putting this message on the queue: '" << data << "'" << endl; > Message sending(data, "bz453598_queue"); > session.messageTransfer(arg::content=sending); > if( subscr.get(received, "bz453598_queue") ) { > cout << "Got message as expected: '" << received.getData() << "' - TEST PASS" << endl; > > cout << "Checking again if SubscriptionManager::get() blocks on empty queue ... "; > cout << " returns " << subscr.get(received, "bz453598_queue") << " - TEST PASS" << endl; > ret = 0; > } else { > cout << "Did not get any message back. *** FAILED ***" << endl; > ret = 1; > } > > // All tests done ... close and quit > connection.close(); > } catch(const std::exception& error) { > cout << error.what() << endl; > ret = 1; > } > return ret; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 461572
: 316158