summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client
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/client
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/client')
-rw-r--r--cpp/src/qpid/client/amqp0_10/AddressResolution.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp b/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp
index 2627c178f9..de6ee0cd2d 100644
--- a/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp
+++ b/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp
@@ -93,6 +93,7 @@ const std::string DURABLE("durable");
const std::string X_DECLARE("x-declare");
const std::string X_SUBSCRIBE("x-subscribe");
const std::string X_BINDINGS("x-bindings");
+const std::string QPID_SELECTOR("qpid.selector");
const std::string EXCHANGE("exchange");
const std::string QUEUE("queue");
const std::string KEY("key");
@@ -315,6 +316,7 @@ struct Opt
Opt(const Variant::Map& base);
Opt& operator/(const std::string& name);
operator bool() const;
+ operator std::string() const;
std::string str() const;
bool asBool(bool defaultValue) const;
const Variant::List& asList() const;
@@ -348,6 +350,11 @@ Opt::operator bool() const
return value && !value->isVoid() && value->asBool();
}
+Opt::operator std::string() const
+{
+ return str();
+}
+
bool Opt::asBool(bool defaultValue) const
{
if (value) return value->asBool();
@@ -470,6 +477,8 @@ QueueSource::QueueSource(const Address& address) :
//options)
exclusive = Opt(address)/LINK/X_SUBSCRIBE/EXCLUSIVE;
(Opt(address)/LINK/X_SUBSCRIBE/ARGUMENTS).collect(options);
+ std::string selector = Opt(address)/LINK/QPID_SELECTOR;
+ if (!selector.empty()) options.setString(QPID_SELECTOR, selector);
}
void QueueSource::subscribe(qpid::client::AsyncSession& session, const std::string& destination)
@@ -981,6 +990,7 @@ Verifier::Verifier()
link[X_SUBSCRIBE] = true;
link[X_DECLARE] = true;
link[X_BINDINGS] = true;
+ link[QPID_SELECTOR] = true;
defined[LINK] = link;
}
void Verifier::verify(const Address& address) const