diff options
Diffstat (limited to 'cpp/src/qpid/broker/ExchangeRegistry.cpp')
-rw-r--r-- | cpp/src/qpid/broker/ExchangeRegistry.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cpp/src/qpid/broker/ExchangeRegistry.cpp b/cpp/src/qpid/broker/ExchangeRegistry.cpp index c1eb5ff5a3..45eb308680 100644 --- a/cpp/src/qpid/broker/ExchangeRegistry.cpp +++ b/cpp/src/qpid/broker/ExchangeRegistry.cpp @@ -67,7 +67,12 @@ pair<Exchange::shared_ptr, bool> ExchangeRegistry::declare(const string& name, c } #endif else{ - throw UnknownExchangeTypeException(); + FunctionMap::iterator i = factory.find(type); + if (i == factory.end()) { + throw UnknownExchangeTypeException(); + } else { + exchange = i->second(name, durable, args, parent); + } } exchanges[name] = exchange; return std::pair<Exchange::shared_ptr, bool>(exchange, true); @@ -92,6 +97,12 @@ Exchange::shared_ptr ExchangeRegistry::get(const string& name){ return i->second; } +void ExchangeRegistry::registerType(const std::string& type, FactoryFunction f) +{ + factory[type] = f; +} + + namespace { const std::string empty; |