diff options
| author | Gordon Sim <gsim@apache.org> | 2006-10-06 16:17:06 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2006-10-06 16:17:06 +0000 |
| commit | 03ec6f44055600e54e7f20ff530ef3ef38eb92f0 (patch) | |
| tree | 90a1168989e5a6ce39f5518f96ff19ef6add7a7a /qpid/cpp/broker/src/Router.cpp | |
| parent | 8068afaf533fe54a175382bd52e2b6dd187e1eb8 (diff) | |
| download | qpid-python-03ec6f44055600e54e7f20ff530ef3ef38eb92f0.tar.gz | |
Decoupled routing from the channel and message classes.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@453657 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/broker/src/Router.cpp')
| -rw-r--r-- | qpid/cpp/broker/src/Router.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/qpid/cpp/broker/src/Router.cpp b/qpid/cpp/broker/src/Router.cpp new file mode 100644 index 0000000000..c2dd74bf7d --- /dev/null +++ b/qpid/cpp/broker/src/Router.cpp @@ -0,0 +1,32 @@ +/* + * + * Copyright (c) 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "Router.h" + +using namespace qpid::broker; + +Router::Router(ExchangeRegistry& _registry) : registry(_registry){} + +void Router::operator()(Message::shared_ptr& msg){ + Exchange* exchange = registry.get(msg->getExchange()); + if(exchange){ + exchange->route(msg, msg->getRoutingKey(), &(msg->getHeaderProperties()->getHeaders())); + }else{ + std::cout << "WARNING: Could not route message, unknown exchange: " << msg->getExchange() << std::endl; + } + +} |
