You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2006/11/20 12:26:51 UTC
svn commit: r477148 - in /incubator/qpid/trunk/qpid/cpp: src/qpid/broker/
test/unit/qpid/broker/
Author: gsim
Date: Mon Nov 20 03:26:45 2006
New Revision: 477148
URL: http://svn.apache.org/viewvc?view=rev&rev=477148
Log:
Modifications to recovery process to allow for recovery of default bindings.
Added:
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp (with props)
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h (with props)
Modified:
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp
incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxAckTest.cpp
incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxPublishTest.cpp
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h?view=diff&rev=477148&r1=477147&r2=477148
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h Mon Nov 20 03:26:45 2006
@@ -22,14 +22,11 @@
#define _MessageStore_
#include <qpid/broker/Message.h>
-#include <qpid/broker/Queue.h>
+#include <qpid/broker/RecoveryManager.h>
#include <qpid/broker/TransactionalStore.h>
namespace qpid {
namespace broker {
- class Queue;
- class QueueRegistry;
-
/**
* An abstraction of the persistent storage for messages.
*/
@@ -47,7 +44,7 @@
/**
* Request recovery of queue and message state from store
*/
- virtual void recover(QueueRegistry& queues) = 0;
+ virtual void recover(RecoveryManager& queues) = 0;
/**
* Enqueues a message, storing the message if it has not
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp?view=diff&rev=477148&r1=477147&r2=477148
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp Mon Nov 20 03:26:45 2006
@@ -38,7 +38,7 @@
store->destroy(queue);
}
-void MessageStoreModule::recover(QueueRegistry& registry)
+void MessageStoreModule::recover(RecoveryManager& registry)
{
store->recover(registry);
}
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h?view=diff&rev=477148&r1=477147&r2=477148
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h Mon Nov 20 03:26:45 2006
@@ -24,7 +24,7 @@
#include <qpid/broker/Message.h>
#include <qpid/broker/MessageStore.h>
#include <qpid/broker/Queue.h>
-#include <qpid/broker/QueueRegistry.h>
+#include <qpid/broker/RecoveryManager.h>
#include <qpid/sys/Module.h>
namespace qpid {
@@ -38,7 +38,7 @@
MessageStoreModule(const std::string& name);
void create(const Queue& queue);
void destroy(const Queue& queue);
- void recover(QueueRegistry& queues);
+ void recover(RecoveryManager& queues);
void enqueue(TransactionContext* ctxt, Message::shared_ptr& msg, const Queue& queue, const string * const xid);
void dequeue(TransactionContext* ctxt, Message::shared_ptr& msg, const Queue& queue, const string * const xid);
void committed(const string * const xid);
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp?view=diff&rev=477148&r1=477147&r2=477148
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp Mon Nov 20 03:26:45 2006
@@ -22,7 +22,7 @@
#include <qpid/broker/NullMessageStore.h>
#include <qpid/broker/Queue.h>
-#include <qpid/broker/QueueRegistry.h>
+#include <qpid/broker/RecoveryManager.h>
#include <iostream>
@@ -34,7 +34,7 @@
void NullMessageStore::destroy(const Queue& queue){
std::cout << "WARNING: Can't destroy durable queue '" << queue.getName() << "'. Persistence not enabled." << std::endl;
}
-void NullMessageStore::recover(QueueRegistry&){
+void NullMessageStore::recover(RecoveryManager&){
std::cout << "WARNING: Persistence not enabled, no recovery of queues or messages." << std::endl;
}
void NullMessageStore::enqueue(TransactionContext*, Message::shared_ptr&, const Queue& queue, const string * const){
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h?view=diff&rev=477148&r1=477147&r2=477148
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h Mon Nov 20 03:26:45 2006
@@ -27,8 +27,6 @@
namespace qpid {
namespace broker {
- class Queue;
- class QueueRegistry;
/**
* A null implementation of the MessageStore interface
@@ -37,7 +35,7 @@
public:
void create(const Queue& queue);
void destroy(const Queue& queue);
- void recover(QueueRegistry& queues);
+ void recover(RecoveryManager& queues);
void enqueue(TransactionContext* ctxt, Message::shared_ptr& msg, const Queue& queue, const string * const xid);
void dequeue(TransactionContext* ctxt, Message::shared_ptr& msg, const Queue& queue, const string * const xid);
void committed(const string * const xid);
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h?view=diff&rev=477148&r1=477147&r2=477148
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h Mon Nov 20 03:26:45 2006
@@ -28,8 +28,6 @@
namespace qpid {
namespace broker {
-class SessionHandlerImpl;
-
/**
* A registry of queues indexed by queue name.
*
Added: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp?view=auto&rev=477148
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp Mon Nov 20 03:26:45 2006
@@ -0,0 +1,42 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 <qpid/broker/RecoveryManager.h>
+
+using namespace qpid::broker;
+
+RecoveryManager::RecoveryManager(QueueRegistry& _queues, ExchangeRegistry& _exchanges) : queues(_queues), exchanges(_exchanges) {}
+
+RecoveryManager::~RecoveryManager() {}
+
+Queue::shared_ptr RecoveryManager::recoverQueue(const string& name)
+{
+ std::pair<Queue::shared_ptr, bool> result = queues.declare(name, true);
+ Exchange::shared_ptr exchange = exchanges.getDefault();
+ if (exchange) {
+ exchange->bind(result.first, result.first->getName(), 0);
+ }
+ return result.first;
+}
+
+Exchange::shared_ptr RecoveryManager::recoverExchange(const string& name, const string& type)
+{
+ return exchanges.declare(name, type).first;
+}
Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h?view=auto&rev=477148
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h (added)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h Mon Nov 20 03:26:45 2006
@@ -0,0 +1,45 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+#ifndef _RecoveryManager_
+#define _RecoveryManager_
+
+#include <qpid/broker/ExchangeRegistry.h>
+#include <qpid/broker/QueueRegistry.h>
+
+namespace qpid {
+namespace broker {
+
+ class RecoveryManager{
+ QueueRegistry& queues;
+ ExchangeRegistry& exchanges;
+ public:
+ RecoveryManager(QueueRegistry& queues, ExchangeRegistry& exchanges);
+ ~RecoveryManager();
+ Queue::shared_ptr recoverQueue(const string& name);
+ Exchange::shared_ptr recoverExchange(const string& name, const string& type);
+ };
+
+
+}
+}
+
+
+#endif
Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp?view=diff&rev=477148&r1=477147&r2=477148
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp Mon Nov 20 03:26:45 2006
@@ -49,7 +49,10 @@
exchanges.declare(amq_fanout, FanOutExchange::typeName);
exchanges.declare(amq_match, HeadersExchange::typeName);
- if(store.get()) store->recover(queues);
+ if(store.get()) {
+ RecoveryManager recoverer(queues, exchanges);
+ store->recover(recoverer);
+ }
cleaner.start();
}
Modified: incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxAckTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxAckTest.cpp?view=diff&rev=477148&r1=477147&r2=477148
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxAckTest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxAckTest.cpp Mon Nov 20 03:26:45 2006
@@ -19,7 +19,7 @@
*
*/
#include <qpid/broker/MessageStore.h>
-#include <qpid/broker/QueueRegistry.h>
+#include <qpid/broker/RecoveryManager.h>
#include <qpid/broker/TxAck.h>
#include <qpid_test_plugin.h>
#include <iostream>
@@ -47,7 +47,7 @@
//dont care about any of the other methods:
void create(const Queue&){}
void destroy(const Queue&){}
- void recover(QueueRegistry&){}
+ void recover(RecoveryManager&){}
void enqueue(TransactionContext*, Message::shared_ptr&, const Queue&, const string * const){}
void committed(const string * const){}
void aborted(const string * const){}
Modified: incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxPublishTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxPublishTest.cpp?view=diff&rev=477148&r1=477147&r2=477148
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxPublishTest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxPublishTest.cpp Mon Nov 20 03:26:45 2006
@@ -19,7 +19,7 @@
*
*/
#include <qpid/broker/MessageStore.h>
-#include <qpid/broker/QueueRegistry.h>
+#include <qpid/broker/RecoveryManager.h>
#include <qpid/broker/TxPublish.h>
#include <qpid_test_plugin.h>
#include <iostream>
@@ -48,7 +48,7 @@
//dont care about any of the other methods:
void create(const Queue&){}
void destroy(const Queue&){}
- void recover(QueueRegistry&){}
+ void recover(RecoveryManager&){}
void dequeue(TransactionContext*, Message::shared_ptr&, const Queue&, const string * const){}
void committed(const string * const){}
void aborted(const string * const){}