Qpid C++ Messaging API  1.39.0
Session.h
1 #ifndef QPID_MESSAGING_SESSION_H
2 #define QPID_MESSAGING_SESSION_H
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 #include "qpid/messaging/ImportExport.h"
25 
26 #include "qpid/messaging/exceptions.h"
27 #include "qpid/messaging/Duration.h"
28 #include "qpid/messaging/Handle.h"
29 
30 #include <string>
31 
32 namespace qpid {
33 namespace messaging {
34 
35 #ifndef SWIG
36 template <class> class PrivateImplRef;
37 #endif
38 class Address;
39 class Connection;
40 class Message;
41 class Sender;
42 class Receiver;
43 class SessionImpl;
44 
49 class QPID_MESSAGING_CLASS_EXTERN Session : public qpid::messaging::Handle<SessionImpl>
50 {
51  public:
52  QPID_MESSAGING_EXTERN Session(SessionImpl* impl = 0);
53  QPID_MESSAGING_EXTERN Session(const Session&);
54  QPID_MESSAGING_EXTERN ~Session();
55  QPID_MESSAGING_EXTERN Session& operator=(const Session&);
56 
63  QPID_MESSAGING_EXTERN void close();
64 
72  QPID_MESSAGING_EXTERN void commit();
73  QPID_MESSAGING_EXTERN void rollback();
74 
82  QPID_MESSAGING_EXTERN void acknowledge(bool sync=false);
86  QPID_MESSAGING_EXTERN void acknowledge(Message&, bool sync=false);
90  QPID_MESSAGING_EXTERN void acknowledgeUpTo(Message&, bool sync=false);
96  QPID_MESSAGING_EXTERN void reject(Message&);
102  QPID_MESSAGING_EXTERN void release(Message&);
103 
112  QPID_MESSAGING_EXTERN void sync(bool block=true);
113 
120  QPID_MESSAGING_EXTERN uint32_t getReceivable();
126  QPID_MESSAGING_EXTERN uint32_t getUnsettledAcks();
135  QPID_MESSAGING_EXTERN bool nextReceiver(Receiver&, Duration timeout=Duration::FOREVER);
144  QPID_MESSAGING_EXTERN Receiver nextReceiver(Duration timeout=Duration::FOREVER);
145 
153  QPID_MESSAGING_EXTERN Sender createSender(const Address& address);
164  QPID_MESSAGING_EXTERN Sender createSender(const std::string& address);
165 
173  QPID_MESSAGING_EXTERN Receiver createReceiver(const Address& address);
184  QPID_MESSAGING_EXTERN Receiver createReceiver(const std::string& address);
185 
190  QPID_MESSAGING_EXTERN Sender getSender(const std::string& name) const;
195  QPID_MESSAGING_EXTERN Receiver getReceiver(const std::string& name) const;
200  QPID_MESSAGING_EXTERN Connection getConnection() const;
201 
206  QPID_MESSAGING_EXTERN bool hasError();
212  QPID_MESSAGING_EXTERN void checkError();
213 
214 #ifndef SWIG
215  private:
216  friend class qpid::messaging::PrivateImplRef<Session>;
217 #endif
218 };
219 }} // namespace qpid::messaging
220 
221 #endif
Definition: Address.h:122
Definition: Receiver.h:45
Definition: Connection.h:36
Definition: Duration.h:35
Definition: Message.h:42
Definition: Connection.h:45
Definition: Handle.h:39
Definition: Session.h:49
Definition: Address.h:32
Definition: Sender.h:44