Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation |
00001 #ifndef QPID_CLIENT_SUBSCRIPTION_H 00002 #define QPID_CLIENT_SUBSCRIPTION_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/Handle.h" 00026 #include "qpid/client/Session.h" 00027 #include "qpid/client/SubscriptionSettings.h" 00028 #include "qpid/client/Message.h" 00029 #include "qpid/client/ClientImportExport.h" 00030 00031 namespace qpid { 00032 namespace client { 00033 00034 template <class> class PrivateImplRef; 00035 class SubscriptionImpl; 00036 class SubscriptionManager; 00037 00042 class QPID_CLIENT_CLASS_EXTERN Subscription : public Handle<SubscriptionImpl> { 00043 public: 00044 QPID_CLIENT_EXTERN Subscription(SubscriptionImpl* = 0); 00045 QPID_CLIENT_EXTERN Subscription(const Subscription&); 00046 QPID_CLIENT_EXTERN ~Subscription(); 00047 QPID_CLIENT_EXTERN Subscription& operator=(const Subscription&); 00048 00049 00053 QPID_CLIENT_EXTERN std::string getName() const; 00054 00056 QPID_CLIENT_EXTERN std::string getQueue() const; 00057 00059 QPID_CLIENT_EXTERN const SubscriptionSettings& getSettings() const; 00060 00062 QPID_CLIENT_EXTERN void setFlowControl(const FlowControl&); 00063 00068 QPID_CLIENT_EXTERN void setAutoAck(unsigned int n); 00069 00073 QPID_CLIENT_EXTERN SequenceSet getUnacquired() const; 00074 00076 QPID_CLIENT_EXTERN SequenceSet getUnaccepted() const; 00077 00081 QPID_CLIENT_EXTERN void acquire(const SequenceSet& messageIds); 00082 00086 QPID_CLIENT_EXTERN void accept(const SequenceSet& messageIds); 00087 00091 QPID_CLIENT_EXTERN void release(const SequenceSet& messageIds); 00092 00093 /* Acquire a single message */ 00094 QPID_CLIENT_INLINE_EXTERN void acquire(const Message& m) { acquire(SequenceSet(m.getId())); } 00095 00096 /* Accept a single message */ 00097 QPID_CLIENT_INLINE_EXTERN void accept(const Message& m) { accept(SequenceSet(m.getId())); } 00098 00099 /* Release a single message */ 00100 QPID_CLIENT_INLINE_EXTERN void release(const Message& m) { release(SequenceSet(m.getId())); } 00101 00103 QPID_CLIENT_EXTERN Session getSession() const; 00104 00106 QPID_CLIENT_EXTERN SubscriptionManager getSubscriptionManager(); 00107 00109 QPID_CLIENT_EXTERN void cancel(); 00110 00112 QPID_CLIENT_EXTERN void grantMessageCredit(uint32_t); 00113 00115 QPID_CLIENT_EXTERN void grantByteCredit(uint32_t); 00116 00117 private: 00118 friend class PrivateImplRef<Subscription>; 00119 friend class SubscriptionManager; 00120 }; 00121 }} // namespace qpid::client 00122 00123 #endif