summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2013-10-15 12:42:01 +0000
committerGordon Sim <gsim@apache.org>2013-10-15 12:42:01 +0000
commit547e869040eda5dadf8f3bca7cfbabf7ad67287b (patch)
tree0b32b8fa4fcc99879fb9af6d7049b504305da9fb /qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
parent16a317a30e82a3f83739f8953ad67babedc6c646 (diff)
downloadqpid-python-547e869040eda5dadf8f3bca7cfbabf7ad67287b.tar.gz
QPID-5232: make subscriptions unreliable and autodeleted by default
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1532308 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp')
-rw-r--r--qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp b/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
index 31704cca73..1b7a47b360 100644
--- a/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
+++ b/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
@@ -45,6 +45,17 @@ void Outgoing::wakeup()
session.wakeup();
}
+namespace {
+bool requested_reliable(pn_link_t* link)
+{
+ return pn_link_remote_snd_settle_mode(link) == PN_SND_UNSETTLED;
+}
+bool requested_unreliable(pn_link_t* link)
+{
+ return pn_link_remote_snd_settle_mode(link) == PN_SND_SETTLED;
+}
+}
+
OutgoingFromQueue::OutgoingFromQueue(Broker& broker, const std::string& source, const std::string& target, boost::shared_ptr<Queue> q, pn_link_t* l, Session& session,
qpid::sys::OutputControl& o, SubscriptionType type, bool e, bool p)
: Outgoing(broker, session, source, target, pn_link_name(l)),
@@ -54,7 +65,8 @@ OutgoingFromQueue::OutgoingFromQueue(Broker& broker, const std::string& source,
queue(q), deliveries(5000), link(l), out(o),
current(0), outstanding(0),
buffer(1024)/*used only for header at present*/,
- unreliable(pn_link_remote_snd_settle_mode(link) == PN_SND_SETTLED)
+ //for exclusive queues, assume unreliable unless reliable is explicitly requested; otherwise assume reliable unless unreliable requested
+ unreliable(exclusive ? !requested_reliable(link) : requested_unreliable(link))
{
for (size_t i = 0 ; i < deliveries.capacity(); ++i) {
deliveries[i].init(i);
@@ -106,8 +118,8 @@ void OutgoingFromQueue::handle(pn_delivery_t* delivery)
write(&buffer[0], encoder.getPosition());
Translation t(r.msg);
t.write(*this);
- if (unreliable) pn_delivery_settle(delivery);
if (pn_link_advance(link)) {
+ if (unreliable) pn_delivery_settle(delivery);
--outstanding;
outgoingMessageSent();
QPID_LOG(debug, "Sent message " << r.msg.getSequence() << " from " << queue->getName() << ", index=" << r.index);