Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation |
00001 #ifndef QPID_MESSAGING_SESSION_H 00002 #define QPID_MESSAGING_SESSION_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/messaging/ImportExport.h" 00025 00026 #include "qpid/messaging/exceptions.h" 00027 #include "qpid/messaging/Duration.h" 00028 #include "qpid/messaging/Handle.h" 00029 00030 #include <string> 00031 00032 namespace qpid { 00033 namespace messaging { 00034 00035 #ifndef SWIG 00036 template <class> class PrivateImplRef; 00037 #endif 00038 class Address; 00039 class Connection; 00040 class Message; 00041 class Sender; 00042 class Receiver; 00043 class SessionImpl; 00044 00049 class QPID_MESSAGING_CLASS_EXTERN Session : public qpid::messaging::Handle<SessionImpl> 00050 { 00051 public: 00052 QPID_MESSAGING_EXTERN Session(SessionImpl* impl = 0); 00053 QPID_MESSAGING_EXTERN Session(const Session&); 00054 QPID_MESSAGING_EXTERN ~Session(); 00055 QPID_MESSAGING_EXTERN Session& operator=(const Session&); 00056 00063 QPID_MESSAGING_EXTERN void close(); 00064 00071 QPID_MESSAGING_EXTERN void commit(); 00072 QPID_MESSAGING_EXTERN void rollback(); 00073 00081 QPID_MESSAGING_EXTERN void acknowledge(bool sync=false); 00085 QPID_MESSAGING_EXTERN void acknowledge(Message&, bool sync=false); 00091 QPID_MESSAGING_EXTERN void reject(Message&); 00097 QPID_MESSAGING_EXTERN void release(Message&); 00098 00107 QPID_MESSAGING_EXTERN void sync(bool block=true); 00108 00115 QPID_MESSAGING_EXTERN uint32_t getReceivable(); 00121 QPID_MESSAGING_EXTERN uint32_t getUnsettledAcks(); 00130 QPID_MESSAGING_EXTERN bool nextReceiver(Receiver&, Duration timeout=Duration::FOREVER); 00139 QPID_MESSAGING_EXTERN Receiver nextReceiver(Duration timeout=Duration::FOREVER); 00140 00148 QPID_MESSAGING_EXTERN Sender createSender(const Address& address); 00159 QPID_MESSAGING_EXTERN Sender createSender(const std::string& address); 00160 00168 QPID_MESSAGING_EXTERN Receiver createReceiver(const Address& address); 00179 QPID_MESSAGING_EXTERN Receiver createReceiver(const std::string& address); 00180 00185 QPID_MESSAGING_EXTERN Sender getSender(const std::string& name) const; 00190 QPID_MESSAGING_EXTERN Receiver getReceiver(const std::string& name) const; 00195 QPID_MESSAGING_EXTERN Connection getConnection() const; 00196 00201 QPID_MESSAGING_EXTERN bool hasError(); 00207 QPID_MESSAGING_EXTERN void checkError(); 00208 00212 QPID_MESSAGING_EXTERN void acknowledgeUpTo(Message&, bool sync=false); 00213 00214 #ifndef SWIG 00215 private: 00216 friend class qpid::messaging::PrivateImplRef<Session>; 00217 #endif 00218 }; 00219 }} // namespace qpid::messaging 00220 00221 #endif