diff options
Diffstat (limited to 'trunk/qpid/cpp/include/qpid/client/MessageListener.h')
-rw-r--r-- | trunk/qpid/cpp/include/qpid/client/MessageListener.h | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/trunk/qpid/cpp/include/qpid/client/MessageListener.h b/trunk/qpid/cpp/include/qpid/client/MessageListener.h deleted file mode 100644 index d200f8cf21..0000000000 --- a/trunk/qpid/cpp/include/qpid/client/MessageListener.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include <string> -#include "qpid/client/ClientImportExport.h" - -#ifndef _MessageListener_ -#define _MessageListener_ - -#include "qpid/client/Message.h" - -namespace qpid { -namespace client { - - /** - * Implement a subclass of MessageListener and subscribe it using - * the SubscriptionManager to receive messages. - * - * Another way to receive messages is by using a LocalQueue. - * - * \ingroup clientapi - * \details - * - * <h2>Using a MessageListener</h2> - * - * <ul> - * <li> - * <p>The received() function is called when a message arrives:</p> - * <pre>virtual void received(Message& message)=0;</pre> - * </li> - * <li> - * <p>Derive your own listener, implement the received() function:</p> - * <pre> - * class Listener : public MessageListener { - * private: - * SubscriptionManager& subscriptions; - * public: - * Listener(SubscriptionManager& subscriptions); - * virtual void received(Message& message); - * }; - * - * Listener::Listener(SubscriptionManager& subs) : subscriptions(subs) - * {} - * - * void Listener::received(Message& message) { - * std::cout << "Message: " << message.getData() << std::endl; - * if (message.getData() == "That's all, folks!") { - * std::cout << "Shutting down listener for " << message.getDestination() - * << std::endl; - * subscriptions.cancel(message.getDestination()); - * } - * } - *</pre> - * <pre> - * SubscriptionManager subscriptions(session); - * - * // Create a listener and subscribe it to the queue named "message_queue" - * Listener listener(subscriptions); - * subscriptions.subscribe(listener, "message_queue"); - * - * // Receive messages until the subscription is cancelled - * // by Listener::received() - * subscriptions.run(); - * </pre> - * </li> - * </ul> - * - */ - - class MessageListener{ - public: - QPID_CLIENT_EXTERN virtual ~MessageListener(); - - /** Called for each message arriving from the broker. Override - * in your own subclass to process messages. - */ - virtual void received(Message& msg) = 0; - }; - -} -} - - -#endif |