diff options
Diffstat (limited to 'cpp/examples/messaging/map_receiver.cpp')
-rw-r--r-- | cpp/examples/messaging/map_receiver.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cpp/examples/messaging/map_receiver.cpp b/cpp/examples/messaging/map_receiver.cpp index 05be4090d2..cdbae6007e 100644 --- a/cpp/examples/messaging/map_receiver.cpp +++ b/cpp/examples/messaging/map_receiver.cpp @@ -38,8 +38,8 @@ using std::string; int main(int argc, char** argv) { const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672"; + Connection connection; try { - Connection connection; connection.open(url); Session session = connection.newSession(); Receiver receiver = session.createReceiver("message_queue"); @@ -52,6 +52,7 @@ int main(int argc, char** argv) { return 0; } catch(const std::exception& error) { std::cout << error.what() << std::endl; + connection.close(); } return 1; } |