diff options
| author | Gordon Sim <gsim@apache.org> | 2014-12-17 14:29:37 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2014-12-17 14:29:37 +0000 |
| commit | 9f634ba1b0f2ee6ea2f2e0c3a7a3d892d3eeda7c (patch) | |
| tree | 962144040d4810cd3f7b8b28718028f69860e6b2 /qpid/cpp/examples/messaging | |
| parent | 39ccbda213efd951ff7355fa1cf2fdc5da58a96b (diff) | |
| download | qpid-python-9f634ba1b0f2ee6ea2f2e0c3a7a3d892d3eeda7c.tar.gz | |
QPID-6273: ensure requests and responses are sent as textual strings rather than binary data
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1646259 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/examples/messaging')
| -rw-r--r-- | qpid/cpp/examples/messaging/client.cpp | 6 | ||||
| -rw-r--r-- | qpid/cpp/examples/messaging/server.cpp | 13 |
2 files changed, 10 insertions, 9 deletions
diff --git a/qpid/cpp/examples/messaging/client.cpp b/qpid/cpp/examples/messaging/client.cpp index 983f0a8878..d695dd9ada 100644 --- a/qpid/cpp/examples/messaging/client.cpp +++ b/qpid/cpp/examples/messaging/client.cpp @@ -39,7 +39,7 @@ using std::string; int main(int argc, char** argv) { const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672"; std::string connectionOptions = argc > 2 ? argv[2] : ""; - + Connection connection(url, connectionOptions); try { connection.open(); @@ -62,10 +62,10 @@ int main(int argc, char** argv) { Message request; request.setReplyTo(responseQueue); for (int i=0; i<4; i++) { - request.setContent(s[i]); + request.setContentObject(s[i]); sender.send(request); Message response = receiver.fetch(); - std::cout << request.getContent() << " -> " << response.getContent() << std::endl; + std::cout << request.getContentObject() << " -> " << response.getContentObject() << std::endl; } connection.close(); return 0; diff --git a/qpid/cpp/examples/messaging/server.cpp b/qpid/cpp/examples/messaging/server.cpp index aa271d91f9..07f4901441 100644 --- a/qpid/cpp/examples/messaging/server.cpp +++ b/qpid/cpp/examples/messaging/server.cpp @@ -52,14 +52,15 @@ int main(int argc, char** argv) { const Address& address = request.getReplyTo(); if (address) { Sender sender = session.createSender(address); - std::string s = request.getContent(); + std::string s = request.getContentObject(); std::transform(s.begin(), s.end(), s.begin(), toupper); - Message response(s); + Message response; + response.setContentObject(s); sender.send(response); - std::cout << "Processed request: " - << request.getContent() - << " -> " - << response.getContent() << std::endl; + std::cout << "Processed request: " + << request.getContentObject() + << " -> " + << response.getContentObject() << std::endl; session.acknowledge(); } else { std::cerr << "Error: no reply address specified for request: " << request.getContent() << std::endl; |
