Qpid C++ Messaging API  0.22
qpid/messaging/Session.h
Go to the documentation of this file.
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);
00089     QPID_MESSAGING_EXTERN void acknowledgeUpTo(Message&, bool sync=false);
00095     QPID_MESSAGING_EXTERN void reject(Message&);
00101     QPID_MESSAGING_EXTERN void release(Message&);
00102 
00111     QPID_MESSAGING_EXTERN void sync(bool block=true);
00112 
00119     QPID_MESSAGING_EXTERN uint32_t getReceivable();
00125     QPID_MESSAGING_EXTERN uint32_t getUnsettledAcks();
00134     QPID_MESSAGING_EXTERN bool nextReceiver(Receiver&, Duration timeout=Duration::FOREVER);
00143     QPID_MESSAGING_EXTERN Receiver nextReceiver(Duration timeout=Duration::FOREVER);
00144     
00152     QPID_MESSAGING_EXTERN Sender createSender(const Address& address);
00163     QPID_MESSAGING_EXTERN Sender createSender(const std::string& address);
00164 
00172     QPID_MESSAGING_EXTERN Receiver createReceiver(const Address& address);
00183     QPID_MESSAGING_EXTERN Receiver createReceiver(const std::string& address);
00184 
00189     QPID_MESSAGING_EXTERN Sender getSender(const std::string& name) const;
00194     QPID_MESSAGING_EXTERN Receiver getReceiver(const std::string& name) const;
00199     QPID_MESSAGING_EXTERN Connection getConnection() const;
00200 
00205     QPID_MESSAGING_EXTERN bool hasError();
00211     QPID_MESSAGING_EXTERN void checkError();
00212 
00213 #ifndef SWIG
00214   private:
00215   friend class qpid::messaging::PrivateImplRef<Session>;
00216 #endif
00217 };
00218 }} // namespace qpid::messaging
00219 
00220 #endif