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/Exception.h" 00025 #include "qpid/client/ClientImportExport.h" 00026 #include "qpid/client/Handle.h" 00027 #include "qpid/sys/Time.h" 00028 #include <string> 00029 00030 namespace qpid { 00031 namespace client { 00032 00033 template <class> class PrivateImplRef; 00034 00035 } 00036 00037 namespace messaging { 00038 00039 class Address; 00040 class Connection; 00041 class Message; 00042 class MessageListener; 00043 class Sender; 00044 class Receiver; 00045 class SessionImpl; 00046 class Subscription; 00047 00048 struct KeyError : qpid::Exception 00049 { 00050 QPID_CLIENT_EXTERN KeyError(const std::string&); 00051 }; 00052 00057 class Session : public qpid::client::Handle<SessionImpl> 00058 { 00059 public: 00060 QPID_CLIENT_EXTERN Session(SessionImpl* impl = 0); 00061 QPID_CLIENT_EXTERN Session(const Session&); 00062 QPID_CLIENT_EXTERN ~Session(); 00063 QPID_CLIENT_EXTERN Session& operator=(const Session&); 00064 00065 QPID_CLIENT_EXTERN void close(); 00066 00067 QPID_CLIENT_EXTERN void commit(); 00068 QPID_CLIENT_EXTERN void rollback(); 00069 00074 QPID_CLIENT_EXTERN void acknowledge(); 00079 QPID_CLIENT_EXTERN void reject(Message&); 00080 00081 QPID_CLIENT_EXTERN void sync(); 00082 QPID_CLIENT_EXTERN void flush(); 00083 00088 QPID_CLIENT_EXTERN uint32_t available(); 00094 QPID_CLIENT_EXTERN uint32_t pendingAck(); 00103 QPID_CLIENT_EXTERN bool nextReceiver(Receiver&, qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE); 00111 QPID_CLIENT_EXTERN Receiver nextReceiver(qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE); 00112 00117 QPID_CLIENT_EXTERN Sender createSender(const Address& address); 00118 QPID_CLIENT_EXTERN Sender createSender(const std::string& address); 00119 00124 QPID_CLIENT_EXTERN Receiver createReceiver(const Address& address); 00125 QPID_CLIENT_EXTERN Receiver createReceiver(const std::string& address); 00126 00131 QPID_CLIENT_EXTERN Sender getSender(const std::string& name) const; 00136 QPID_CLIENT_EXTERN Receiver getReceiver(const std::string& name) const; 00141 QPID_CLIENT_EXTERN Connection getConnection() const; 00142 00143 private: 00144 friend class qpid::client::PrivateImplRef<Session>; 00145 }; 00146 }} // namespace qpid::messaging 00147 00148 #endif