From afefc741a9ad4c6299a47805a45a1c81a048e0a2 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 20 Jan 2009 13:30:08 +0000 Subject: QPID-1567: added 'exactly-once' guarantee to asynchronous replication of queue state * altered replication protocol to detect and eliminate duplicates * added support for acknowledged transfer over inter-broker bridges * added option to qpid-route to control this git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@736018 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/SemanticState.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'cpp/src/qpid/broker/SemanticState.cpp') diff --git a/cpp/src/qpid/broker/SemanticState.cpp b/cpp/src/qpid/broker/SemanticState.cpp index d9896b388b..f9f75679e5 100644 --- a/cpp/src/qpid/broker/SemanticState.cpp +++ b/cpp/src/qpid/broker/SemanticState.cpp @@ -256,7 +256,9 @@ SemanticState::ConsumerImpl::ConsumerImpl(SemanticState* _parent, arguments(_arguments), msgCredit(0), byteCredit(0), - notifyEnabled(true) {} + notifyEnabled(true), + syncFrequency(_arguments.getAsInt("qpid.sync_frequency")), + deliveryCount(0) {} OwnershipToken* SemanticState::ConsumerImpl::getSession() { @@ -267,7 +269,9 @@ bool SemanticState::ConsumerImpl::deliver(QueuedMessage& msg) { allocateCredit(msg.payload); DeliveryRecord record(msg, queue, name, acquire, !ackExpected, windowing); - parent->deliver(record); + bool sync = syncFrequency && ++deliveryCount >= syncFrequency; + if (sync) deliveryCount = 0;//reset + parent->deliver(record, sync); if (!ackExpected) record.setEnded();//allows message to be released now its been delivered if (windowing || ackExpected || !acquire) { parent->record(record); @@ -449,9 +453,9 @@ void SemanticState::recover(bool requeue) } } -void SemanticState::deliver(DeliveryRecord& msg) +void SemanticState::deliver(DeliveryRecord& msg, bool sync) { - return deliveryAdapter.deliver(msg); + return deliveryAdapter.deliver(msg, sync); } SemanticState::ConsumerImpl& SemanticState::find(const std::string& destination) -- cgit v1.2.1