/usr/share/cruisecontrol-bin-2.6.1/projects/qpid-trunk/cpp/src/qpid/client/SubscriptionManager.h

00001 #ifndef QPID_CLIENT_SUBSCRIPTIONMANAGER_H
00002 #define QPID_CLIENT_SUBSCRIPTIONMANAGER_H
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  * 
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  * 
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 #include "qpid/sys/Mutex.h"
00025 #include <qpid/client/Dispatcher.h>
00026 #include <qpid/client/Completion.h>
00027 #include <qpid/client/Session.h>
00028 #include <qpid/client/MessageListener.h>
00029 #include <qpid/client/LocalQueue.h>
00030 #include <qpid/sys/Runnable.h>
00031 
00032 #include <set>
00033 #include <sstream>
00034 
00035 namespace qpid {
00036 namespace client {
00037 
00043 class SubscriptionManager : public sys::Runnable
00044 {
00045     typedef sys::Mutex::ScopedLock Lock;
00046     typedef sys::Mutex::ScopedUnlock Unlock;
00047 
00048     Completion subscribeInternal(const std::string& q, const std::string& dest);
00049     
00050     qpid::client::Dispatcher dispatcher;
00051     qpid::client::Session& session;
00052     uint32_t messages;
00053     uint32_t bytes;
00054     bool window;
00055     AckPolicy autoAck;
00056     bool confirmMode;
00057     bool acquireMode;
00058     bool autoStop;
00059     
00060   public:
00061     SubscriptionManager(Session& session);
00062     
00071     Completion subscribe(MessageListener& listener,
00072                          const std::string& queue,
00073                          const std::string& tag=std::string());
00074 
00082     Completion subscribe(LocalQueue& localQueue,
00083                    const std::string& queue,
00084                    const std::string& tag=std::string());
00085 
00087     void cancel(const std::string tag);
00088 
00090     void run();
00091 
00096     void setAutoStop(bool set=true);
00097 
00099     void stop();
00100 
00101 
00102     static const uint32_t UNLIMITED=0xFFFFFFFF;
00103 
00110     void setFlowControl(const std::string& tag, uint32_t messages,  uint32_t bytes, bool window=true);
00111 
00117     void setFlowControl(uint32_t messages,  uint32_t bytes, bool window=true);
00118 
00123     void setConfirmMode(bool confirm);
00124 
00130     void setAcquireMode(bool acquire);
00131 
00135     void setAckPolicy(const AckPolicy& autoAck);
00136 };
00137 
00138 
00139 }} // namespace qpid::client
00140 
00141 #endif  

Generated on Thu Apr 10 11:08:18 2008 for Qpid by  doxygen 1.4.7