Apache Qpid C++ API
Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation

qpid/client/SubscriptionImpl.h

Go to the documentation of this file.
00001 #ifndef QPID_CLIENT_SUBSCRIPTIONIMPL_H
00002 #define QPID_CLIENT_SUBSCRIPTIONIMPL_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 
00025 #include "qpid/client/SubscriptionSettings.h"
00026 #include "qpid/client/Session.h"
00027 #include "qpid/client/MessageListener.h"
00028 #include "qpid/client/Demux.h"
00029 #include "qpid/framing/enum.h"
00030 #include "qpid/framing/SequenceSet.h"
00031 #include "qpid/sys/Mutex.h"
00032 #include "qpid/RefCounted.h"
00033 #include <memory>
00034 
00035 namespace qpid {
00036 namespace client {
00037 
00038 class SubscriptionManager;
00039 
00040 class SubscriptionImpl : public RefCounted, public MessageListener {
00041   public:
00042     SubscriptionImpl(SubscriptionManager&, const std::string& queue,
00043                      const SubscriptionSettings&, const std::string& name, MessageListener* =0);
00044     
00048     std::string getName() const;
00049 
00051     std::string getQueue() const;
00052 
00054     const SubscriptionSettings& getSettings() const;
00055 
00057     void setFlowControl(const FlowControl&);
00058 
00063     void setAutoAck(size_t n);
00064 
00068     SequenceSet getUnacquired() const;
00069 
00071     SequenceSet getUnaccepted() const;
00072 
00074     void acquire(const SequenceSet& messageIds);
00075 
00077     void accept(const SequenceSet& messageIds);
00078 
00080     void release(const SequenceSet& messageIds);
00081 
00083     Session getSession() const;
00084 
00086     SubscriptionManager& getSubscriptionManager() const;
00087 
00089     void subscribe();
00090 
00092     void cancel();
00093 
00095     void grantCredit(framing::message::CreditUnit unit, uint32_t value);
00096 
00097     void received(Message&);
00098 
00102     Demux::QueuePtr divert();
00107     void cancelDiversion();
00108 
00109   private:
00110 
00111     mutable sys::Mutex lock;
00112     SubscriptionManager& manager;
00113     std::string name, queue;
00114     SubscriptionSettings settings;
00115     framing::SequenceSet unacquired, unaccepted;
00116     MessageListener* listener;
00117     std::auto_ptr<ScopedDivert> demuxRule;
00118 };
00119 
00120 }} // namespace qpid::client
00121 
00122 #endif  

Qpid C++ API Reference
Generated on Tue Dec 8 15:39:36 2009 for Qpid C++ Client API by doxygen 1.4.7