diff options
Diffstat (limited to 'cpp/include/qpid')
-rw-r--r-- | cpp/include/qpid/messaging/Receiver.h | 6 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/Sender.h | 5 | ||||
-rw-r--r-- | cpp/include/qpid/messaging/Session.h | 27 |
3 files changed, 37 insertions, 1 deletions
diff --git a/cpp/include/qpid/messaging/Receiver.h b/cpp/include/qpid/messaging/Receiver.h index 659a583547..2dc62b1598 100644 --- a/cpp/include/qpid/messaging/Receiver.h +++ b/cpp/include/qpid/messaging/Receiver.h @@ -110,6 +110,12 @@ class Receiver : public qpid::client::Handle<ReceiverImpl> * Cancels this receiver. */ QPID_CLIENT_EXTERN void cancel(); + + /** + * Returns the name of this receiver. + */ + QPID_CLIENT_EXTERN const std::string& getName() const; + private: friend class qpid::client::PrivateImplRef<Receiver>; }; diff --git a/cpp/include/qpid/messaging/Sender.h b/cpp/include/qpid/messaging/Sender.h index 9b83a04d60..29af3810f4 100644 --- a/cpp/include/qpid/messaging/Sender.h +++ b/cpp/include/qpid/messaging/Sender.h @@ -24,6 +24,7 @@ #include "qpid/client/ClientImportExport.h" #include "qpid/client/Handle.h" #include "qpid/sys/IntegerTypes.h" +#include <string> namespace qpid { namespace client { @@ -68,6 +69,10 @@ class Sender : public qpid::client::Handle<SenderImpl> */ QPID_CLIENT_EXTERN uint32_t pending(); + /** + * Returns the name of this sender. + */ + QPID_CLIENT_EXTERN const std::string& getName() const; private: friend class qpid::client::PrivateImplRef<Sender>; }; diff --git a/cpp/include/qpid/messaging/Session.h b/cpp/include/qpid/messaging/Session.h index 4b23d355ec..edb6fa6331 100644 --- a/cpp/include/qpid/messaging/Session.h +++ b/cpp/include/qpid/messaging/Session.h @@ -21,6 +21,7 @@ * under the License. * */ +#include "qpid/Exception.h" #include "qpid/client/ClientImportExport.h" #include "qpid/client/Handle.h" #include "qpid/sys/Time.h" @@ -43,6 +44,11 @@ class Receiver; class SessionImpl; class Subscription; +struct KeyError : qpid::Exception +{ + QPID_CLIENT_EXTERN KeyError(const std::string&); +}; + /** * A session represents a distinct 'conversation' which can involve * sending and receiving messages to and from different addresses. @@ -103,11 +109,30 @@ class Session : public qpid::client::Handle<SessionImpl> */ QPID_CLIENT_EXTERN Receiver nextReceiver(qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE); - + /** + * Create a new sender through which messages can be sent to the + * specified address. + */ QPID_CLIENT_EXTERN Sender createSender(const Address& address); QPID_CLIENT_EXTERN Sender createSender(const std::string& address); + + /** + * Create a new receiver through which messages can be received + * from the specified address. + */ QPID_CLIENT_EXTERN Receiver createReceiver(const Address& address); QPID_CLIENT_EXTERN Receiver createReceiver(const std::string& address); + + /** + * Returns the sender with the specified name or throws KeyError + * if there is none for that name. + */ + QPID_CLIENT_EXTERN Sender getSender(const std::string& name) const; + /** + * Returns the receiver with the specified name or throws KeyError + * if there is none for that name. + */ + QPID_CLIENT_EXTERN Receiver getReceiver(const std::string& name) const; private: friend class qpid::client::PrivateImplRef<Session>; }; |