summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/SemanticState.cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2013-03-04 21:08:17 +0000
committerAndrew Stitcher <astitcher@apache.org>2013-03-04 21:08:17 +0000
commitb77019ea048947bdaf983295e7246a8dd8dc53d2 (patch)
tree461900ca2b53c7ed5fc02e733466b2b7569f3c97 /cpp/src/qpid/broker/SemanticState.cpp
parent221259deec8b45854d03926b68a6ffa4928fbb3b (diff)
downloadqpid-python-b77019ea048947bdaf983295e7246a8dd8dc53d2.tar.gz
QPID-4558: Selectors for C++ broker
- Add support to 0-10 protocol codepaths in client messaging library and the broker to transmit a selector when subscribing to a queue - This is specified by using a link property qpid.selector in the queue address. - The selector is actually transmitted under 0-10 as an user vlaue named qpid.selector in the arguments table of the subscription. - Added simple selector framework to broker. - Added in infrastructure for selector evaluation -- Put in place a trivial (but real) selector: The expression specifies a message property and returns true if it is present. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1452522 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/SemanticState.cpp')
-rw-r--r--cpp/src/qpid/broker/SemanticState.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/SemanticState.cpp b/cpp/src/qpid/broker/SemanticState.cpp
index 66d9a95cfc..60c2d6e555 100644
--- a/cpp/src/qpid/broker/SemanticState.cpp
+++ b/cpp/src/qpid/broker/SemanticState.cpp
@@ -28,6 +28,7 @@
#include "qpid/broker/DtxTimeout.h"
#include "qpid/broker/Message.h"
#include "qpid/broker/Queue.h"
+#include "qpid/broker/Selector.h"
#include "qpid/broker/SessionContext.h"
#include "qpid/broker/SessionOutputException.h"
#include "qpid/broker/TxAccept.h"
@@ -285,6 +286,7 @@ void SemanticState::record(const DeliveryRecord& delivery)
}
const std::string QPID_SYNC_FREQUENCY("qpid.sync_frequency");
+const std::string QPID_SELECTOR("qpid.selector");
SemanticStateConsumerImpl::SemanticStateConsumerImpl(SemanticState* _parent,
const string& _name,
@@ -307,6 +309,7 @@ Consumer(_name, type),
exclusive(_exclusive),
resumeId(_resumeId),
tag(_tag),
+ selector(returnSelector(_arguments.getAsString(QPID_SELECTOR))),
resumeTtl(_resumeTtl),
arguments(_arguments),
notifyEnabled(true),
@@ -378,9 +381,9 @@ bool SemanticStateConsumerImpl::deliver(const QueueCursor& cursor, const Message
return true;
}
-bool SemanticStateConsumerImpl::filter(const Message&)
+bool SemanticStateConsumerImpl::filter(const Message& msg)
{
- return true;
+ return !selector || selector->filter(msg);
}
bool SemanticStateConsumerImpl::accept(const Message& msg)