Inheritance diagram for org::xmlBlaster::util::queue::SQLiteQueuePlugin:
Public Member Functions | |
SQLiteQueuePlugin (org::xmlBlaster::util::Global &global, org::xmlBlaster::util::qos::storage::ClientQueueProperty &property) | |
virtual | ~SQLiteQueuePlugin () |
Shutdown the queue, keep existing entries. | |
org::xmlBlaster::util::I_Log & | getLog () |
Access logging framework. | |
void | put (MsgQueueEntry &entry) |
puts a new entry into the queue. | |
std::vector< EntryType > | peekWithSamePriority (long maxNumOfEntries=-1, long maxNumOfBytes=-1) |
Returns the entries with the highest priority in the queue. | |
long | randomRemove (std::vector< EntryType >::const_iterator &start, std::vector< EntryType >::const_iterator &end) |
Deletes the entries specified in the std::vector in the argument list. | |
long | getNumOfEntries () |
Access the current number of entries. | |
long | getMaxNumOfEntries () |
Access the configured maximum number of elements for this queue. | |
int64_t | getNumOfBytes () |
Returns the amount of bytes currently in the queue. | |
int64_t | getMaxNumOfBytes () |
Access the configured capacity (maximum bytes) for this queue. | |
void | clear () |
Clears (removes all entries) this queue. | |
bool | empty () |
returns true if the queue is empty, false otherwise | |
org::xmlBlaster::util::XmlBlasterException | convertFromQueueException (::ExceptionStruct *ex) |
Converts the C ExceptionStruct into our XmlBlasterException class. | |
std::string | getType () |
Get the name of the plugin. | |
std::string | getVersion () |
Get the version of the plugin. | |
void | destroy () |
Removes all entries and cleans up the storage, for example with a database it would remove all tables and relating database files. | |
Static Public Member Functions | |
static void | parseEmbeddedType (std::string &embeddedType, std::string &type, std::string &methodName) |
Parse the embedded type information. | |
static std::string | usage () |
Protected Attributes | |
std::string | ME |
org::xmlBlaster::util::Global & | global_ |
org::xmlBlaster::util::I_Log & | log_ |
Properties | |
org::xmlBlaster::util::qos::storage::QueuePropertyBase | _ |
::I_QueueStruct * | queueP_ |
org::xmlBlaster::util::qos::ConnectQosFactory | connectQosFactory_ |
org::xmlBlaster::util::qos::StatusQosFactory | statusQosFactory_ |
org::xmlBlaster::util::key::MsgKeyFactory | msgKeyFactory_ |
org::xmlBlaster::util::qos::MsgQosFactory | msgQosFactory_ |
org::xmlBlaster::util::thread::Mutex | accessMutex_ |
This class wraps the ANSI C based persistent queue implementation xmlBlaster/src/c/util/queue/SQLiteQueue.c
.
Definition at line 36 of file SQLiteQueuePlugin.h.
org::xmlBlaster::util::queue::SQLiteQueuePlugin::SQLiteQueuePlugin | ( | org::xmlBlaster::util::Global & | global, | |
org::xmlBlaster::util::qos::storage::ClientQueueProperty & | property | |||
) |
Definition at line 38 of file SQLiteQueuePlugin.cpp.
References org::xmlBlaster::util::I_Log::call(), convertFromQueueException(), createQueue(), org::xmlBlaster::util::Property::get(), org::xmlBlaster::util::qos::storage::QueuePropertyBase::getMaxEntries(), org::xmlBlaster::util::Global::getProperty(), org::xmlBlaster::util::Global::getStrippedImmutableId(), getType(), getVersion(), global_, org::xmlBlaster::util::I_Log::info(), log_, ME, QUEUE_DBNAME_MAX, QUEUE_ID_MAX, QUEUE_PREFIX_MAX, queueP_, org::xmlBlaster::util::I_Log::trace(), and org::xmlBlaster::util::I_Log::warn().
org::xmlBlaster::util::queue::SQLiteQueuePlugin::~SQLiteQueuePlugin | ( | ) | [virtual] |
Shutdown the queue, keep existing entries.
Definition at line 126 of file SQLiteQueuePlugin.cpp.
References accessMutex_, org::xmlBlaster::util::I_Log::call(), log_, ME, queueP_, I_QueueStruct::shutdown, and org::xmlBlaster::util::I_Log::warn().
org::xmlBlaster::util::I_Log& org::xmlBlaster::util::queue::SQLiteQueuePlugin::getLog | ( | ) |
void org::xmlBlaster::util::queue::SQLiteQueuePlugin::put | ( | MsgQueueEntry & | entry | ) | [virtual] |
puts a new entry into the queue.
Note that this method takes the entry pointed to by the argument and puts a reference to it into the queue. This means that you can not destroy the entry before the reference to it has been removed from the queue (which normally happens on a remove or when destroying the queue.
Implements org::xmlBlaster::util::queue::I_Queue.
Definition at line 141 of file SQLiteQueuePlugin.cpp.
References accessMutex_, org::xmlBlaster::util::I_Log::call(), convertFromQueueException(), org::xmlBlaster::util::queue::BlobHolder::data, org::xmlBlaster::util::queue::BlobHolder::dataLen, org::xmlBlaster::util::I_Log::dump(), org::xmlBlaster::util::queue::MsgQueueEntry::getEmbeddedObject(), org::xmlBlaster::util::queue::MsgQueueEntry::getEmbeddedType(), org::xmlBlaster::util::queue::MsgQueueEntry::getLogId(), org::xmlBlaster::util::queue::MsgQueueEntry::getPriority(), org::xmlBlaster::util::queue::MsgQueueEntry::getSizeInBytes(), org::xmlBlaster::util::queue::MsgQueueEntry::getUniqueId(), org::xmlBlaster::util::INTERNAL_ILLEGALARGUMENT, org::xmlBlaster::util::queue::MsgQueueEntry::isPersistent(), log_, ME, I_QueueStruct::put, QUEUE_ENTRY_EMBEDDEDTYPE_LEN, queueP_, org::xmlBlaster::util::RESOURCE_DB_UNAVAILABLE, and org::xmlBlaster::util::queue::MsgQueueEntry::toXml().
vector< EntryType > org::xmlBlaster::util::queue::SQLiteQueuePlugin::peekWithSamePriority | ( | long | maxNumOfEntries = -1 , |
|
long | maxNumOfBytes = -1 | |||
) | [virtual] |
Returns the entries with the highest priority in the queue.
If 'maxNumOfEntries' is positive, this is the maximum number of entries to return. If maxNumOfBytes is positive, only the entries which fit into the range specified are returned. If there are no such entries, an empty std::vector is returned.
Implements org::xmlBlaster::util::queue::I_Queue.
Definition at line 181 of file SQLiteQueuePlugin.cpp.
References accessMutex_, org::xmlBlaster::util::I_Log::call(), org::xmlBlaster::util::MethodName::CONNECT, connectQosFactory_, convertFromQueueException(), org::xmlBlaster::util::I_Log::dump(), I_QueueStruct::empty, org::xmlBlaster::util::Constants::ENTRY_TYPE_MSG_RAW, org::xmlBlaster::util::I_Log::error(), freeQueueEntryArr(), global_, org::xmlBlaster::util::INTERNAL_UNKNOWN, log_, ME, msgKeyFactory_, msgQosFactory_, parseEmbeddedType(), I_QueueStruct::peekWithSamePriority, org::xmlBlaster::util::MethodName::PUBLISH, queueP_, org::xmlBlaster::util::qos::ConnectQosFactory::readObject(), org::xmlBlaster::util::qos::MsgQosFactory::readObject(), org::xmlBlaster::util::key::MsgKeyFactory::readObject(), org::xmlBlaster::util::RESOURCE_DB_UNAVAILABLE, and org::xmlBlaster::util::I_Log::trace().
long org::xmlBlaster::util::queue::SQLiteQueuePlugin::randomRemove | ( | std::vector< EntryType >::const_iterator & | start, | |
std::vector< EntryType >::const_iterator & | end | |||
) | [virtual] |
Deletes the entries specified in the std::vector in the argument list.
If this std::vector is empty or if the queue is empty, zero (0) is returned, otherwise it returns the number of entries really deleted.
Implements org::xmlBlaster::util::queue::I_Queue.
long org::xmlBlaster::util::queue::SQLiteQueuePlugin::getNumOfEntries | ( | ) | [virtual] |
Access the current number of entries.
Implements org::xmlBlaster::util::queue::I_Queue.
Definition at line 334 of file SQLiteQueuePlugin.cpp.
References I_QueueStruct::getNumOfEntries, ME, queueP_, and org::xmlBlaster::util::RESOURCE_DB_UNAVAILABLE.
long org::xmlBlaster::util::queue::SQLiteQueuePlugin::getMaxNumOfEntries | ( | ) | [virtual] |
Access the configured maximum number of elements for this queue.
Implements org::xmlBlaster::util::queue::I_Queue.
Definition at line 340 of file SQLiteQueuePlugin.cpp.
References I_QueueStruct::getMaxNumOfEntries, and queueP_.
int64_t org::xmlBlaster::util::queue::SQLiteQueuePlugin::getNumOfBytes | ( | ) | [virtual] |
Returns the amount of bytes currently in the queue.
If the implementation of this interface is not able to return the correct number of entries (for example if the implementation must make a remote call to a DB which is temporarly not available) it will return -1.
Implements org::xmlBlaster::util::queue::I_Queue.
Definition at line 346 of file SQLiteQueuePlugin.cpp.
References I_QueueStruct::getNumOfBytes, ME, queueP_, and org::xmlBlaster::util::RESOURCE_DB_UNAVAILABLE.
int64_t org::xmlBlaster::util::queue::SQLiteQueuePlugin::getMaxNumOfBytes | ( | ) | [virtual] |
Access the configured capacity (maximum bytes) for this queue.
Implements org::xmlBlaster::util::queue::I_Queue.
Definition at line 352 of file SQLiteQueuePlugin.cpp.
References I_QueueStruct::getMaxNumOfBytes, and queueP_.
void org::xmlBlaster::util::queue::SQLiteQueuePlugin::clear | ( | ) | [virtual] |
Clears (removes all entries) this queue.
Implements org::xmlBlaster::util::queue::I_Queue.
Definition at line 358 of file SQLiteQueuePlugin.cpp.
References accessMutex_, I_QueueStruct::clear, ME, queueP_, and org::xmlBlaster::util::RESOURCE_DB_UNAVAILABLE.
int org::xmlBlaster::util::queue::SQLiteQueuePlugin::empty | ( | ) | [virtual] |
returns true if the queue is empty, false otherwise
Implements org::xmlBlaster::util::queue::I_Queue.
Definition at line 367 of file SQLiteQueuePlugin.cpp.
References I_QueueStruct::empty, ME, queueP_, and org::xmlBlaster::util::RESOURCE_DB_UNAVAILABLE.
org::xmlBlaster::util::XmlBlasterException org::xmlBlaster::util::queue::SQLiteQueuePlugin::convertFromQueueException | ( | ::ExceptionStruct * | ex | ) |
Converts the C ExceptionStruct into our XmlBlasterException class.
Definition at line 382 of file SQLiteQueuePlugin.cpp.
References org::xmlBlaster::util::Global::getBuildTimestamp(), org::xmlBlaster::util::Global::getVersion(), global_, and ME.
Referenced by destroy(), peekWithSamePriority(), put(), and SQLiteQueuePlugin().
static void org::xmlBlaster::util::queue::SQLiteQueuePlugin::parseEmbeddedType | ( | std::string & | embeddedType, | |
std::string & | type, | |||
std::string & | methodName | |||
) | [static] |
Parse the embedded type information.
embeddedType | The input, for example "MSG_RAW|publish" | |
type | Output: "MSG_RAW" (the SOCKET serialization format) | |
methodName | Output: "publish" (see MethodName.cpp) |
Referenced by peekWithSamePriority().
string org::xmlBlaster::util::queue::SQLiteQueuePlugin::usage | ( | ) | [static] |
Definition at line 393 of file SQLiteQueuePlugin.cpp.
References org::xmlBlaster::util::qos::storage::ClientQueueProperty::usage().
Referenced by org::xmlBlaster::util::queue::CacheQueuePlugin::usage().
std::string org::xmlBlaster::util::queue::SQLiteQueuePlugin::getType | ( | ) | [virtual] |
Get the name of the plugin.
Implements org::xmlBlaster::util::plugin::I_Plugin.
Definition at line 147 of file SQLiteQueuePlugin.h.
Referenced by SQLiteQueuePlugin().
std::string org::xmlBlaster::util::queue::SQLiteQueuePlugin::getVersion | ( | ) | [virtual] |
Get the version of the plugin.
Implements org::xmlBlaster::util::plugin::I_Plugin.
Definition at line 154 of file SQLiteQueuePlugin.h.
Referenced by SQLiteQueuePlugin().
void org::xmlBlaster::util::queue::SQLiteQueuePlugin::destroy | ( | ) | [virtual] |
Removes all entries and cleans up the storage, for example with a database it would remove all tables and relating database files.
This is an administrative task. The class instance calling destroy()
is invalid after this call
XmlBlasterException | if failed |
Implements org::xmlBlaster::util::queue::I_Queue.
Definition at line 373 of file SQLiteQueuePlugin.cpp.
References convertFromQueueException(), I_QueueStruct::destroy, ME, queueP_, and org::xmlBlaster::util::RESOURCE_DB_UNAVAILABLE.
std::string org::xmlBlaster::util::queue::SQLiteQueuePlugin::ME [protected] |
Definition at line 43 of file SQLiteQueuePlugin.h.
Referenced by clear(), convertFromQueueException(), destroy(), empty(), getNumOfBytes(), getNumOfEntries(), peekWithSamePriority(), put(), SQLiteQueuePlugin(), and ~SQLiteQueuePlugin().
Definition at line 44 of file SQLiteQueuePlugin.h.
Referenced by convertFromQueueException(), peekWithSamePriority(), and SQLiteQueuePlugin().
Definition at line 45 of file SQLiteQueuePlugin.h.
Referenced by peekWithSamePriority(), put(), SQLiteQueuePlugin(), and ~SQLiteQueuePlugin().
org::xmlBlaster::util::qos::storage::QueuePropertyBase org::xmlBlaster::util::queue::SQLiteQueuePlugin::_ [protected] |
Definition at line 46 of file SQLiteQueuePlugin.h.
struct ::I_QueueStruct* org::xmlBlaster::util::queue::SQLiteQueuePlugin::queueP_ [protected] |
Definition at line 47 of file SQLiteQueuePlugin.h.
Referenced by clear(), destroy(), empty(), getMaxNumOfBytes(), getMaxNumOfEntries(), getNumOfBytes(), getNumOfEntries(), peekWithSamePriority(), put(), SQLiteQueuePlugin(), and ~SQLiteQueuePlugin().
org::xmlBlaster::util::qos::ConnectQosFactory org::xmlBlaster::util::queue::SQLiteQueuePlugin::connectQosFactory_ [mutable, protected] |
org::xmlBlaster::util::qos::StatusQosFactory org::xmlBlaster::util::queue::SQLiteQueuePlugin::statusQosFactory_ [mutable, protected] |
Definition at line 49 of file SQLiteQueuePlugin.h.
org::xmlBlaster::util::key::MsgKeyFactory org::xmlBlaster::util::queue::SQLiteQueuePlugin::msgKeyFactory_ [mutable, protected] |
org::xmlBlaster::util::qos::MsgQosFactory org::xmlBlaster::util::queue::SQLiteQueuePlugin::msgQosFactory_ [mutable, protected] |
org::xmlBlaster::util::thread::Mutex org::xmlBlaster::util::queue::SQLiteQueuePlugin::accessMutex_ [protected] |
Definition at line 52 of file SQLiteQueuePlugin.h.
Referenced by clear(), peekWithSamePriority(), put(), and ~SQLiteQueuePlugin().