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/Session.h" 00026 #include "qpid/client/SubscriptionSettings.h" 00027 #include "qpid/client/Handle.h" 00028 #include "qpid/client/Message.h" 00029 00030 namespace qpid { 00031 namespace client { 00032 00033 class SubscriptionImpl; 00034 class SubscriptionManager; 00035 00040 class Subscription : public Handle<SubscriptionImpl> { 00041 public: 00042 Subscription(SubscriptionImpl* si=0) : Handle<SubscriptionImpl>(si) {} 00043 00047 std::string getName() const; 00048 00050 std::string getQueue() const; 00051 00053 const SubscriptionSettings& getSettings() const; 00054 00056 void setFlowControl(const FlowControl&); 00057 00062 void setAutoAck(unsigned int n); 00063 00067 SequenceSet getUnacquired() const; 00068 00070 SequenceSet getUnaccepted() const; 00071 00075 void acquire(const SequenceSet& messageIds); 00076 00080 void accept(const SequenceSet& messageIds); 00081 00085 void release(const SequenceSet& messageIds); 00086 00087 /* Acquire a single message */ 00088 void acquire(const Message& m) { acquire(SequenceSet(m.getId())); } 00089 00090 /* Accept a single message */ 00091 void accept(const Message& m) { accept(SequenceSet(m.getId())); } 00092 00093 /* Release a single message */ 00094 void release(const Message& m) { release(SequenceSet(m.getId())); } 00095 00097 Session getSession() const; 00098 00100 SubscriptionManager& getSubscriptionManager() const; 00101 00103 void cancel(); 00104 00106 void grantMessageCredit(uint32_t); 00107 00109 void grantByteCredit(uint32_t); 00110 00111 friend class SubscriptionManager; 00112 }; 00113 }} // namespace qpid::client 00114 00115 #endif