diff options
author | Kenneth Anthony Giusti <kgiusti@apache.org> | 2010-05-21 17:39:51 +0000 |
---|---|---|
committer | Kenneth Anthony Giusti <kgiusti@apache.org> | 2010-05-21 17:39:51 +0000 |
commit | a3462820c7f5af8bbb7300334c49d47b239fe901 (patch) | |
tree | a7b80c797d774f43130dd67e9c6e00ca7fee1ced /cpp/src/qmf/engine/ConsoleImpl.cpp | |
parent | b8d8b5b3b620e63052f60524ebb54ef0be92c6d1 (diff) | |
download | qpid-python-a3462820c7f5af8bbb7300334c49d47b239fe901.tar.gz |
QMF: add bindEvent api to allow filtering of unsolicted events.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@947084 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qmf/engine/ConsoleImpl.cpp')
-rw-r--r-- | cpp/src/qmf/engine/ConsoleImpl.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cpp/src/qmf/engine/ConsoleImpl.cpp b/cpp/src/qmf/engine/ConsoleImpl.cpp index 1b66d9e81f..4a5da31bdc 100644 --- a/cpp/src/qmf/engine/ConsoleImpl.cpp +++ b/cpp/src/qmf/engine/ConsoleImpl.cpp @@ -259,6 +259,32 @@ void ConsoleImpl::bindClass(const char* packageName, const char* className) (*iter)->addBinding(QMF_EXCHANGE, key.str()); } + +void ConsoleImpl::bindEvent(const SchemaClassKey* classKey) +{ + bindEvent(classKey->getPackageName(), classKey->getClassName()); +} + +void ConsoleImpl::bindEvent(const char* packageName, const char* eventName) +{ + if (!settings.userBindings) throw qpid::Exception("Console not configured for userBindings."); + if (settings.rcvEvents) throw qpid::Exception("Console already configured to receive all events."); + + stringstream key; + key << "console.event.*.*." << packageName; + if (eventName && *eventName) { + key << "." << eventName << ".#"; + } else { + key << ".#"; + } + + Mutex::ScopedLock _lock(lock); + bindingList.push_back(pair<string, string>(string(), key.str())); + for (vector<BrokerProxyImpl*>::iterator iter = brokerList.begin(); + iter != brokerList.end(); iter++) + (*iter)->addBinding(QMF_EXCHANGE, key.str()); +} + /* void ConsoleImpl::startSync(const Query& query, void* context, SyncQuery& sync) { @@ -421,6 +447,10 @@ const SchemaEventClass* Console::getEventClass(const SchemaClassKey* key) const void Console::bindPackage(const char* packageName) { impl->bindPackage(packageName); } void Console::bindClass(const SchemaClassKey* key) { impl->bindClass(key); } void Console::bindClass(const char* packageName, const char* className) { impl->bindClass(packageName, className); } + +void Console::bindEvent(const SchemaClassKey *key) { impl->bindEvent(key); } +void Console::bindEvent(const char* packageName, const char* eventName) { impl->bindEvent(packageName, eventName); } + //void Console::startSync(const Query& query, void* context, SyncQuery& sync) { impl->startSync(query, context, sync); } //void Console::touchSync(SyncQuery& sync) { impl->touchSync(sync); } //void Console::endSync(SyncQuery& sync) { impl->endSync(sync); } |