diff options
| author | Gordon Sim <gsim@apache.org> | 2013-03-23 17:59:50 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2013-03-23 17:59:50 +0000 |
| commit | cfa98a776511eb4a713c7e87796bc3fcfaafbe42 (patch) | |
| tree | 95bbf3dc2b114627fa5d03d394fcf70cd37da6e4 /cpp/src/qpid/messaging | |
| parent | 964edfa59bd065b1db97ea16932ef2553ee8ac04 (diff) | |
| download | qpid-python-cfa98a776511eb4a713c7e87796bc3fcfaafbe42.tar.gz | |
QPID-4586: fixes for dynamic sources/targets and on demand creation of nodes
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1460198 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/messaging')
| -rw-r--r-- | cpp/src/qpid/messaging/Address.cpp | 48 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/AddressImpl.h | 44 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/AddressParser.cpp | 6 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/Receiver.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/ReceiverImpl.h | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/Sender.cpp | 3 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/SenderImpl.h | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/AddressHelper.cpp | 36 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/AddressHelper.h | 3 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 22 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/ReceiverContext.cpp | 24 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/ReceiverContext.h | 3 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/ReceiverHandle.cpp | 5 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/ReceiverHandle.h | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/SenderContext.cpp | 23 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/SenderContext.h | 3 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/SenderHandle.cpp | 5 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/SenderHandle.h | 1 |
18 files changed, 155 insertions, 78 deletions
diff --git a/cpp/src/qpid/messaging/Address.cpp b/cpp/src/qpid/messaging/Address.cpp index a516959edb..6fbaeef661 100644 --- a/cpp/src/qpid/messaging/Address.cpp +++ b/cpp/src/qpid/messaging/Address.cpp @@ -19,6 +19,8 @@ * */ #include "qpid/messaging/Address.h" +#include "qpid/messaging/AddressImpl.h" +#include "qpid/messaging/AddressParser.h" #include "qpid/framing/Uuid.h" #include <sstream> #include <boost/format.hpp> @@ -34,51 +36,9 @@ const std::string OPTIONS_DIVIDER = ";"; const std::string SPACE = " "; const std::string TYPE = "type"; } -class AddressImpl -{ - public: - std::string name; - std::string subject; - Variant::Map options; - - AddressImpl() {} - AddressImpl(const std::string& n, const std::string& s, const Variant::Map& o) : - name(n), subject(s), options(o) {} -}; - -class AddressParser -{ - public: - AddressParser(const std::string&); - bool parse(Address& address); - private: - const std::string& input; - std::string::size_type current; - static const std::string RESERVED; - - bool readChar(char c); - bool readQuotedString(std::string& s); - bool readQuotedValue(Variant& value); - bool readString(std::string& value, char delimiter); - bool readWord(std::string& word, const std::string& delims = RESERVED); - bool readSimpleValue(Variant& word); - bool readKey(std::string& key); - bool readValue(Variant& value); - bool readKeyValuePair(Variant::Map& map); - bool readMap(Variant& value); - bool readList(Variant& value); - bool readName(std::string& name); - bool readSubject(std::string& subject); - bool error(const std::string& message); - bool eos(); - bool iswhitespace(); - bool in(const std::string& delims); - bool isreserved(); -}; - Address::Address() : impl(new AddressImpl()) {} Address::Address(const std::string& address) : impl(new AddressImpl()) -{ +{ AddressParser parser(address); parser.parse(*this); } @@ -86,7 +46,7 @@ Address::Address(const std::string& name, const std::string& subject, const Vari const std::string& type) : impl(new AddressImpl(name, subject, options)) { setType(type); } Address::Address(const Address& a) : - impl(new AddressImpl(a.impl->name, a.impl->subject, a.impl->options)) {} + impl(new AddressImpl(a.impl->name, a.impl->subject, a.impl->options)) { impl->temporary = a.impl->temporary; } Address::~Address() { delete impl; } Address& Address::operator=(const Address& a) { *impl = *a.impl; return *this; } diff --git a/cpp/src/qpid/messaging/AddressImpl.h b/cpp/src/qpid/messaging/AddressImpl.h new file mode 100644 index 0000000000..e35aa7fef2 --- /dev/null +++ b/cpp/src/qpid/messaging/AddressImpl.h @@ -0,0 +1,44 @@ +#ifndef QPID_MESSAGING_ADDRESSIMPL_H +#define QPID_MESSAGING_ADDRESSIMPL_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +#include "qpid/types/Variant.h" +namespace qpid { +namespace messaging { + +class AddressImpl +{ + public: + std::string name; + std::string subject; + qpid::types::Variant::Map options; + bool temporary; + + AddressImpl() : temporary(false) {} + AddressImpl(const std::string& n, const std::string& s, const qpid::types::Variant::Map& o) : + name(n), subject(s), options(o), temporary(false) {} + static void setTemporary(Address& a, bool value) { a.impl->temporary = value; } + static bool isTemporary(const Address& a) { return a.impl->temporary; } +}; +}} // namespace qpid::messaging + +#endif /*!QPID_MESSAGING_ADDRESSIMPL_H*/ diff --git a/cpp/src/qpid/messaging/AddressParser.cpp b/cpp/src/qpid/messaging/AddressParser.cpp index 67249e188e..882deba463 100644 --- a/cpp/src/qpid/messaging/AddressParser.cpp +++ b/cpp/src/qpid/messaging/AddressParser.cpp @@ -19,6 +19,7 @@ * */ #include "AddressParser.h" +#include "AddressImpl.h" #include "qpid/framing/Uuid.h" #include <boost/format.hpp> @@ -38,7 +39,10 @@ bool AddressParser::parse(Address& address) { std::string name; if (readName(name)) { - if (name.find('#') == 0) name = qpid::framing::Uuid(true).str() + name; + if (name.find('#') == 0) { + name = qpid::framing::Uuid(true).str() + name; + AddressImpl::setTemporary(address, true); + } address.setName(name); if (readChar('/')) { std::string subject; diff --git a/cpp/src/qpid/messaging/Receiver.cpp b/cpp/src/qpid/messaging/Receiver.cpp index 78e0c5daa3..c45ebd6760 100644 --- a/cpp/src/qpid/messaging/Receiver.cpp +++ b/cpp/src/qpid/messaging/Receiver.cpp @@ -19,6 +19,7 @@ * */ #include "qpid/messaging/Receiver.h" +#include "qpid/messaging/Address.h" #include "qpid/messaging/Message.h" #include "qpid/messaging/ReceiverImpl.h" #include "qpid/messaging/Session.h" @@ -45,4 +46,5 @@ void Receiver::close() { impl->close(); } const std::string& Receiver::getName() const { return impl->getName(); } Session Receiver::getSession() const { return impl->getSession(); } bool Receiver::isClosed() const { return impl->isClosed(); } +Address Receiver::getAddress() const { return impl->getAddress(); } }} // namespace qpid::messaging diff --git a/cpp/src/qpid/messaging/ReceiverImpl.h b/cpp/src/qpid/messaging/ReceiverImpl.h index e450693d2c..59ccc3214e 100644 --- a/cpp/src/qpid/messaging/ReceiverImpl.h +++ b/cpp/src/qpid/messaging/ReceiverImpl.h @@ -27,6 +27,7 @@ namespace qpid { namespace messaging { +class Address; class Duration; class Message; class MessageListener; @@ -48,6 +49,7 @@ class ReceiverImpl : public virtual qpid::RefCounted virtual const std::string& getName() const = 0; virtual Session getSession() const = 0; virtual bool isClosed() const = 0; + virtual Address getAddress() const = 0; }; }} // namespace qpid::messaging diff --git a/cpp/src/qpid/messaging/Sender.cpp b/cpp/src/qpid/messaging/Sender.cpp index 53dbb69777..a60de3d606 100644 --- a/cpp/src/qpid/messaging/Sender.cpp +++ b/cpp/src/qpid/messaging/Sender.cpp @@ -19,6 +19,7 @@ * */ #include "qpid/messaging/Sender.h" +#include "qpid/messaging/Address.h" #include "qpid/messaging/Message.h" #include "qpid/messaging/SenderImpl.h" #include "qpid/messaging/Session.h" @@ -40,5 +41,5 @@ uint32_t Sender::getUnsettled() { return impl->getUnsettled(); } uint32_t Sender::getAvailable() { return getCapacity() - getUnsettled(); } const std::string& Sender::getName() const { return impl->getName(); } Session Sender::getSession() const { return impl->getSession(); } - +Address Sender::getAddress() const { return impl->getAddress(); } }} // namespace qpid::messaging diff --git a/cpp/src/qpid/messaging/SenderImpl.h b/cpp/src/qpid/messaging/SenderImpl.h index d978463fdb..91fd9b1536 100644 --- a/cpp/src/qpid/messaging/SenderImpl.h +++ b/cpp/src/qpid/messaging/SenderImpl.h @@ -27,6 +27,7 @@ namespace qpid { namespace messaging { +class Address; class Message; class Session; @@ -41,6 +42,7 @@ class SenderImpl : public virtual qpid::RefCounted virtual uint32_t getUnsettled() = 0; virtual const std::string& getName() const = 0; virtual Session getSession() const = 0; + virtual Address getAddress() const = 0; private: }; }} // namespace qpid::messaging diff --git a/cpp/src/qpid/messaging/amqp/AddressHelper.cpp b/cpp/src/qpid/messaging/amqp/AddressHelper.cpp index 359660dce5..a46606a526 100644 --- a/cpp/src/qpid/messaging/amqp/AddressHelper.cpp +++ b/cpp/src/qpid/messaging/amqp/AddressHelper.cpp @@ -20,6 +20,7 @@ */ #include "qpid/messaging/amqp/AddressHelper.h" #include "qpid/messaging/Address.h" +#include "qpid/log/Statement.h" #include <vector> #include <boost/assign.hpp> extern "C" { @@ -56,7 +57,9 @@ const std::string MOVE("move"); const std::string COPY("copy"); const std::string SUPPORTED_DIST_MODES("supported-dist-modes"); +const std::string CREATE_ON_DEMAND("create-on-demand"); +const std::string DUMMY("."); const std::vector<std::string> RECEIVER_MODES = boost::assign::list_of<std::string>(ALWAYS) (RECEIVER); const std::vector<std::string> SENDER_MODES = boost::assign::list_of<std::string>(ALWAYS) (SENDER); @@ -155,26 +158,33 @@ const qpid::types::Variant::Map& AddressHelper::getLinkProperties() const return link; } -void AddressHelper::setNodeProperties(pn_terminus_t* terminus) +void AddressHelper::setNodeProperties(pn_terminus_t* terminus, bool dynamic) { - pn_terminus_set_dynamic(terminus, true); + if (dynamic) { + pn_terminus_set_address(terminus, DUMMY.c_str());//Workaround for proton bug + pn_terminus_set_dynamic(terminus, true); + } else { + pn_data_t* capabilities = pn_terminus_capabilities(terminus); + if (!capabilities) { + QPID_LOG(error, "!!!No capabilities!!!"); + } + pn_data_put_symbol(capabilities, convert(CREATE_ON_DEMAND)); + } //properties for dynamically created node: - pn_data_t* data = pn_terminus_properties(terminus); if (node.size()) { + pn_data_t* data = pn_terminus_properties(terminus); pn_data_put_map(data); pn_data_enter(data); - } - for (qpid::types::Variant::Map::const_iterator i = node.begin(); i != node.end(); ++i) { - if (i->first == TYPE) { - pn_data_put_symbol(data, convert(SUPPORTED_DIST_MODES)); - pn_data_put_string(data, convert(i->second == TOPIC ? COPY : MOVE)); - } else { - pn_data_put_symbol(data, convert(i->first)); - pn_data_put_string(data, convert(i->second.asString())); + for (qpid::types::Variant::Map::const_iterator i = node.begin(); i != node.end(); ++i) { + if (i->first == TYPE) { + pn_data_put_symbol(data, convert(SUPPORTED_DIST_MODES)); + pn_data_put_string(data, convert(i->second == TOPIC ? COPY : MOVE)); + } else { + pn_data_put_symbol(data, convert(i->first)); + pn_data_put_string(data, convert(i->second.asString())); + } } - } - if (node.size()) { pn_data_exit(data); } } diff --git a/cpp/src/qpid/messaging/amqp/AddressHelper.h b/cpp/src/qpid/messaging/amqp/AddressHelper.h index cd0aa1be9e..2442619ed3 100644 --- a/cpp/src/qpid/messaging/amqp/AddressHelper.h +++ b/cpp/src/qpid/messaging/amqp/AddressHelper.h @@ -40,7 +40,7 @@ class AddressHelper bool deleteEnabled(CheckMode mode) const; bool assertEnabled(CheckMode mode) const; - void setNodeProperties(pn_terminus_t*); + void setNodeProperties(pn_terminus_t*, bool dynamic); const qpid::types::Variant::Map& getNodeProperties() const; const qpid::types::Variant::Map& getLinkProperties() const; private: @@ -49,6 +49,7 @@ class AddressHelper std::string deletePolicy; qpid::types::Variant::Map node; qpid::types::Variant::Map link; + std::string name; bool enabled(const std::string& policy, CheckMode mode) const; }; diff --git a/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index c74ee01898..9febe66f7e 100644 --- a/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp @@ -26,6 +26,7 @@ #include "SessionContext.h" #include "Transport.h" #include "qpid/messaging/exceptions.h" +#include "qpid/messaging/AddressImpl.h" #include "qpid/messaging/Duration.h" #include "qpid/messaging/Message.h" #include "qpid/messaging/MessageImpl.h" @@ -285,34 +286,45 @@ void ConnectionContext::attach(boost::shared_ptr<SessionContext> ssn, boost::sha { lnk->configure(); attach(ssn->session, (pn_link_t*) lnk->sender); - if (!pn_link_remote_target((pn_link_t*) lnk->sender)) { + pn_terminus_t* t = pn_link_remote_target(lnk->sender); + if (!pn_terminus_get_address(t)) { std::string msg("No such target : "); msg += lnk->getTarget(); + QPID_LOG(debug, msg); throw qpid::messaging::NotFound(msg); + } else if (AddressImpl::isTemporary(lnk->address)) { + lnk->address.setName(pn_terminus_get_address(t)); + QPID_LOG(debug, "Dynamic target name set to " << lnk->address.getName()); } + QPID_LOG(debug, "Attach succeeded to " << lnk->getTarget()); } void ConnectionContext::attach(boost::shared_ptr<SessionContext> ssn, boost::shared_ptr<ReceiverContext> lnk) { lnk->configure(); attach(ssn->session, lnk->receiver, lnk->capacity); - if (!pn_link_remote_source(lnk->receiver)) { + pn_terminus_t* s = pn_link_remote_source(lnk->receiver); + if (!pn_terminus_get_address(s)) { std::string msg("No such source : "); msg += lnk->getSource(); + QPID_LOG(debug, msg); throw qpid::messaging::NotFound(msg); + } else if (AddressImpl::isTemporary(lnk->address)) { + lnk->address.setName(pn_terminus_get_address(s)); + QPID_LOG(debug, "Dynamic source name set to " << lnk->address.getName()); } + QPID_LOG(debug, "Attach succeeded from " << lnk->getSource()); } void ConnectionContext::attach(pn_session_t* /*session*/, pn_link_t* link, int credit) { qpid::sys::ScopedLock<qpid::sys::Monitor> l(lock); - QPID_LOG(debug, "Attaching link " << link << ", state=" << pn_link_state(link)); pn_link_open(link); - QPID_LOG(debug, "Link attached " << link << ", state=" << pn_link_state(link)); + QPID_LOG(debug, "Link attach sent for " << link << ", state=" << pn_link_state(link)); if (credit) pn_link_flow(link, credit); wakeupDriver(); while (pn_link_state(link) & PN_REMOTE_UNINIT) { - QPID_LOG(debug, "waiting for confirmation of link attach for " << link << ", state=" << pn_link_state(link)); + QPID_LOG(debug, "Waiting for confirmation of link attach for " << link << ", state=" << pn_link_state(link) << "..."); wait(); } } diff --git a/cpp/src/qpid/messaging/amqp/ReceiverContext.cpp b/cpp/src/qpid/messaging/amqp/ReceiverContext.cpp index e5f6738b61..f7b06ddc05 100644 --- a/cpp/src/qpid/messaging/amqp/ReceiverContext.cpp +++ b/cpp/src/qpid/messaging/amqp/ReceiverContext.cpp @@ -20,9 +20,11 @@ */ #include "qpid/messaging/amqp/ReceiverContext.h" #include "qpid/messaging/amqp/AddressHelper.h" +#include "qpid/messaging/AddressImpl.h" #include "qpid/messaging/Duration.h" #include "qpid/messaging/Message.h" #include "qpid/amqp/descriptors.h" +#include "qpid/log/Statement.h" extern "C" { #include <proton/engine.h> } @@ -38,7 +40,7 @@ ReceiverContext::ReceiverContext(pn_session_t* session, const std::string& n, co capacity(0) {} ReceiverContext::~ReceiverContext() { - pn_link_free(receiver); + //pn_link_free(receiver); } void ReceiverContext::setCapacity(uint32_t c) @@ -76,7 +78,7 @@ uint32_t ReceiverContext::getUnsettled() void ReceiverContext::close() { - + pn_link_close(receiver); } const std::string& ReceiverContext::getName() const @@ -113,11 +115,18 @@ void ReceiverContext::configure() const } void ReceiverContext::configure(pn_terminus_t* source) const { - pn_terminus_set_address(source, address.getName().c_str()); //dynamic create: AddressHelper helper(address); - if (helper.createEnabled(AddressHelper::FOR_RECEIVER)) { - helper.setNodeProperties(source); + if (AddressImpl::isTemporary(address)) { + //application expects a name to be generated + QPID_LOG(debug, "source is dynamic"); + helper.setNodeProperties(source, true); + } else { + pn_terminus_set_address(source, address.getName().c_str()); + if (helper.createEnabled(AddressHelper::FOR_RECEIVER)) { + //application expects name of node to be as specified + helper.setNodeProperties(source, false); + } } // Look specifically for qpid.selector link property and add a filter for it @@ -149,6 +158,11 @@ void ReceiverContext::configure(pn_terminus_t* source) const } } +Address ReceiverContext::getAddress() const +{ + return address; +} + bool ReceiverContext::isClosed() const { return false;//TODO diff --git a/cpp/src/qpid/messaging/amqp/ReceiverContext.h b/cpp/src/qpid/messaging/amqp/ReceiverContext.h index 34ecdda6be..9c5386157b 100644 --- a/cpp/src/qpid/messaging/amqp/ReceiverContext.h +++ b/cpp/src/qpid/messaging/amqp/ReceiverContext.h @@ -55,10 +55,11 @@ class ReceiverContext const std::string& getSource() const; bool isClosed() const; void configure() const; + Address getAddress() const; private: friend class ConnectionContext; const std::string name; - const Address address; + Address address; pn_link_t* receiver; uint32_t capacity; void configure(pn_terminus_t*) const; diff --git a/cpp/src/qpid/messaging/amqp/ReceiverHandle.cpp b/cpp/src/qpid/messaging/amqp/ReceiverHandle.cpp index 9bf64ebb8d..c601d05ed0 100644 --- a/cpp/src/qpid/messaging/amqp/ReceiverHandle.cpp +++ b/cpp/src/qpid/messaging/amqp/ReceiverHandle.cpp @@ -103,4 +103,9 @@ bool ReceiverHandle::isClosed() const return receiver->isClosed(); } +Address ReceiverHandle::getAddress() const +{ + return receiver->getAddress(); +} + }}} // namespace qpid::messaging::amqp diff --git a/cpp/src/qpid/messaging/amqp/ReceiverHandle.h b/cpp/src/qpid/messaging/amqp/ReceiverHandle.h index a1a6f26025..08a95fb585 100644 --- a/cpp/src/qpid/messaging/amqp/ReceiverHandle.h +++ b/cpp/src/qpid/messaging/amqp/ReceiverHandle.h @@ -53,6 +53,7 @@ class ReceiverHandle : public qpid::messaging::ReceiverImpl const std::string& getName() const; qpid::messaging::Session getSession() const; bool isClosed() const; + Address getAddress() const; private: boost::shared_ptr<ConnectionContext> connection; boost::shared_ptr<SessionContext> session; diff --git a/cpp/src/qpid/messaging/amqp/SenderContext.cpp b/cpp/src/qpid/messaging/amqp/SenderContext.cpp index 96c4437b89..fe74a4bca8 100644 --- a/cpp/src/qpid/messaging/amqp/SenderContext.cpp +++ b/cpp/src/qpid/messaging/amqp/SenderContext.cpp @@ -21,6 +21,7 @@ #include "qpid/messaging/amqp/SenderContext.h" #include "qpid/messaging/amqp/EncodedMessage.h" #include "qpid/messaging/amqp/AddressHelper.h" +#include "qpid/messaging/AddressImpl.h" #include "qpid/amqp/descriptors.h" #include "qpid/amqp/MessageEncoder.h" #include "qpid/messaging/exceptions.h" @@ -44,12 +45,12 @@ SenderContext::SenderContext(pn_session_t* session, const std::string& n, const SenderContext::~SenderContext() { - pn_link_free(sender); + //pn_link_free(sender); } void SenderContext::close() { - + pn_link_close(sender); } void SenderContext::setCapacity(uint32_t c) @@ -347,11 +348,16 @@ void SenderContext::configure() const } void SenderContext::configure(pn_terminus_t* target) const { - pn_terminus_set_address(target, address.getName().c_str()); - //dynamic create: AddressHelper helper(address); - if (helper.createEnabled(AddressHelper::FOR_SENDER)) { - helper.setNodeProperties(target); + if (AddressImpl::isTemporary(address)) { + //application expects a name to be generated + helper.setNodeProperties(target, true); + } else { + pn_terminus_set_address(target, address.getName().c_str()); + if (helper.createEnabled(AddressHelper::FOR_SENDER)) { + //application expects name of node to be as specified + helper.setNodeProperties(target, false); + } } } @@ -360,4 +366,9 @@ bool SenderContext::settled() return processUnsettled() == 0; } +Address SenderContext::getAddress() const +{ + return address; +} + }}} // namespace qpid::messaging::amqp diff --git a/cpp/src/qpid/messaging/amqp/SenderContext.h b/cpp/src/qpid/messaging/amqp/SenderContext.h index 3595379e70..2969e75a16 100644 --- a/cpp/src/qpid/messaging/amqp/SenderContext.h +++ b/cpp/src/qpid/messaging/amqp/SenderContext.h @@ -71,12 +71,13 @@ class SenderContext Delivery* send(const qpid::messaging::Message& message); void configure() const; bool settled(); + Address getAddress() const; private: friend class ConnectionContext; typedef std::deque<Delivery> Deliveries; const std::string name; - const qpid::messaging::Address address; + qpid::messaging::Address address; pn_link_t* sender; int32_t nextId; Deliveries deliveries; diff --git a/cpp/src/qpid/messaging/amqp/SenderHandle.cpp b/cpp/src/qpid/messaging/amqp/SenderHandle.cpp index b7168e5b31..4e258e7b38 100644 --- a/cpp/src/qpid/messaging/amqp/SenderHandle.cpp +++ b/cpp/src/qpid/messaging/amqp/SenderHandle.cpp @@ -72,4 +72,9 @@ qpid::messaging::Session SenderHandle::getSession() const return qpid::messaging::Session(new SessionHandle(connection, session)); } +Address SenderHandle::getAddress() const +{ + return sender->getAddress(); +} + }}} // namespace qpid::messaging::amqp diff --git a/cpp/src/qpid/messaging/amqp/SenderHandle.h b/cpp/src/qpid/messaging/amqp/SenderHandle.h index 3c6b666582..fab158c1ef 100644 --- a/cpp/src/qpid/messaging/amqp/SenderHandle.h +++ b/cpp/src/qpid/messaging/amqp/SenderHandle.h @@ -48,6 +48,7 @@ class SenderHandle : public qpid::messaging::SenderImpl uint32_t getUnsettled(); const std::string& getName() const; Session getSession() const; + Address getAddress() const; private: boost::shared_ptr<ConnectionContext> connection; boost::shared_ptr<SessionContext> session; |
