org::xmlBlaster::util::queue::I_Queue Class Reference

Interface for queue implementations (RAM, JDBC or CACHE). More...

Inheritance diagram for org::xmlBlaster::util::queue::I_Queue:

Inheritance graph
[legend]
Collaboration diagram for org::xmlBlaster::util::queue::I_Queue:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~I_Queue ()
virtual void put (MsgQueueEntry &entry)=0
 Puts a new entry into the queue.
virtual std::vector< EntryTypepeekWithSamePriority (long maxNumOfEntries=-1, long maxNumOfBytes=-1)=0
 Returns the entries with the highest priority in the queue.
virtual long randomRemove (std::vector< EntryType >::const_iterator &start, std::vector< EntryType >::const_iterator &end)=0
 Deletes the entries specified in the std::vector in the argument list.
virtual long getNumOfEntries ()=0
 Access the current number of entries.
virtual long getMaxNumOfEntries ()=0
 Access the configured maximum number of elements for this queue.
virtual int64_t getNumOfBytes ()=0
 Returns the amount of bytes currently in the queue.
virtual int64_t getMaxNumOfBytes ()=0
 Access the configured capacity (maximum bytes) for this queue.
virtual void clear ()=0
 Clears (removes all entries) this queue
Exceptions:
XmlBlasterException on problems.

virtual bool empty ()=0
 
Returns:
true if the queue is empty, false otherwise
Exceptions:
XmlBlasterException on problems

virtual void destroy ()=0
 Removes all entries and cleans up the storage, for example with a database it would remove all tables and relating database files.

Detailed Description

Interface for queue implementations (RAM, JDBC or CACHE).

Author:
Michele Laghi

Marcel Ruff

Definition at line 27 of file I_Queue.h.


Constructor & Destructor Documentation

virtual org::xmlBlaster::util::queue::I_Queue::~I_Queue (  )  [virtual]

Definition at line 30 of file I_Queue.h.


Member Function Documentation

virtual void org::xmlBlaster::util::queue::I_Queue::put ( MsgQueueEntry entry  )  [pure virtual]

Puts a new entry into the queue.

The put() method takes a clone of the passed entry, you can safely destroy your passed entry after this invocation.

Parameters:
entry A message which is stored in the queue
Exceptions:
XmlBlasterException on problems

Implemented in org::xmlBlaster::util::queue::CacheQueuePlugin, org::xmlBlaster::util::queue::RamQueuePlugin, and org::xmlBlaster::util::queue::SQLiteQueuePlugin.

Referenced by org::xmlBlaster::util::queue::CacheQueuePlugin::put(), org::xmlBlaster::util::dispatch::ConnectionsHandler::queuePublish(), org::xmlBlaster::util::dispatch::ConnectionsHandler::queueSubscribe(), org::xmlBlaster::test::TestQueue::testMaxNumOfBytes(), org::xmlBlaster::test::TestQueue::testMaxNumOfEntries(), org::xmlBlaster::test::TestQueue::testOrder(), org::xmlBlaster::test::TestQueue::testWithOneConnectEntry(), and org::xmlBlaster::test::TestQueue::testWithOnePublishEntry().

virtual std::vector<EntryType> org::xmlBlaster::util::queue::I_Queue::peekWithSamePriority ( long  maxNumOfEntries = -1,
long  maxNumOfBytes = -1 
) [pure 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.

Returns:
A vector with EntryType, this smart pointer wraps the real message, you don't need to take care on freeing memory.
Exceptions:
XmlBlasterException on problems

Implemented in org::xmlBlaster::util::queue::CacheQueuePlugin, org::xmlBlaster::util::queue::RamQueuePlugin, and org::xmlBlaster::util::queue::SQLiteQueuePlugin.

Referenced by org::xmlBlaster::util::dispatch::ConnectionsHandler::flushQueueUnlocked(), org::xmlBlaster::util::queue::CacheQueuePlugin::peekWithSamePriority(), org::xmlBlaster::test::TestQueue::testOrder(), org::xmlBlaster::test::TestQueue::testWithOneConnectEntry(), and org::xmlBlaster::test::TestQueue::testWithOnePublishEntry().

virtual long org::xmlBlaster::util::queue::I_Queue::randomRemove ( std::vector< EntryType >::const_iterator &  start,
std::vector< EntryType >::const_iterator &  end 
) [pure 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.

Parameters:
start The inclusive beginning of the messages to remove
end The exclusive ending
Returns:
Number of entries removed
Exceptions:
XmlBlasterException on problems

Implemented in org::xmlBlaster::util::queue::CacheQueuePlugin, org::xmlBlaster::util::queue::RamQueuePlugin, and org::xmlBlaster::util::queue::SQLiteQueuePlugin.

Referenced by org::xmlBlaster::util::dispatch::ConnectionsHandler::flushQueueUnlocked(), org::xmlBlaster::test::TestQueue::testOrder(), org::xmlBlaster::test::TestQueue::testWithOneConnectEntry(), and org::xmlBlaster::test::TestQueue::testWithOnePublishEntry().

virtual long org::xmlBlaster::util::queue::I_Queue::getNumOfEntries (  )  [pure virtual]

Access the current number of entries.

Returns:
The number of entries in the queue

Implemented in org::xmlBlaster::util::queue::CacheQueuePlugin, org::xmlBlaster::util::queue::RamQueuePlugin, and org::xmlBlaster::util::queue::SQLiteQueuePlugin.

Referenced by HelloWorld2::execute(), org::xmlBlaster::util::dispatch::ConnectionsHandler::flushQueue(), org::xmlBlaster::util::dispatch::ConnectionsHandler::flushQueueUnlocked(), org::xmlBlaster::util::queue::CacheQueuePlugin::getNumOfEntries(), org::xmlBlaster::util::dispatch::ConnectionsHandler::getQueue(), org::xmlBlaster::util::dispatch::ConnectionsHandler::putToQueue(), HelloWorld2::reachedAlive(), HelloWorld2::reachedPolling(), org::xmlBlaster::test::TestQueue::testMaxNumOfBytes(), and org::xmlBlaster::test::TestQueue::testWithOnePublishEntry().

virtual long org::xmlBlaster::util::queue::I_Queue::getMaxNumOfEntries (  )  [pure virtual]

Access the configured maximum number of elements for this queue.

Returns:
The maximum number of elements in the queue

Implemented in org::xmlBlaster::util::queue::CacheQueuePlugin, org::xmlBlaster::util::queue::RamQueuePlugin, and org::xmlBlaster::util::queue::SQLiteQueuePlugin.

Referenced by org::xmlBlaster::util::queue::CacheQueuePlugin::getMaxNumOfEntries().

virtual int64_t org::xmlBlaster::util::queue::I_Queue::getNumOfBytes (  )  [pure 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.

Returns:
The amount of bytes currently in the queue, returns -1 on error

Implemented in org::xmlBlaster::util::queue::CacheQueuePlugin, org::xmlBlaster::util::queue::RamQueuePlugin, and org::xmlBlaster::util::queue::SQLiteQueuePlugin.

Referenced by org::xmlBlaster::util::queue::CacheQueuePlugin::getNumOfBytes(), and org::xmlBlaster::test::TestQueue::testMaxNumOfBytes().

virtual int64_t org::xmlBlaster::util::queue::I_Queue::getMaxNumOfBytes (  )  [pure virtual]

Access the configured capacity (maximum bytes) for this queue.

Returns:
The maximum capacity for the queue in bytes

Implemented in org::xmlBlaster::util::queue::CacheQueuePlugin, org::xmlBlaster::util::queue::RamQueuePlugin, and org::xmlBlaster::util::queue::SQLiteQueuePlugin.

Referenced by org::xmlBlaster::util::queue::CacheQueuePlugin::getMaxNumOfBytes(), and org::xmlBlaster::test::TestQueue::testMaxNumOfBytes().

virtual void org::xmlBlaster::util::queue::I_Queue::clear (  )  [pure virtual]

Clears (removes all entries) this queue

Exceptions:
XmlBlasterException on problems.

Implemented in org::xmlBlaster::util::queue::CacheQueuePlugin, org::xmlBlaster::util::queue::RamQueuePlugin, and org::xmlBlaster::util::queue::SQLiteQueuePlugin.

Referenced by org::xmlBlaster::util::queue::CacheQueuePlugin::clear(), org::xmlBlaster::util::dispatch::ConnectionsHandler::disconnect(), HelloWorld2::reachedAlive(), and org::xmlBlaster::test::TestQueue::testMaxNumOfEntries().

virtual bool org::xmlBlaster::util::queue::I_Queue::empty (  )  [pure virtual]

Returns:
true if the queue is empty, false otherwise
Exceptions:
XmlBlasterException on problems

Implemented in org::xmlBlaster::util::queue::CacheQueuePlugin, org::xmlBlaster::util::queue::RamQueuePlugin, and org::xmlBlaster::util::queue::SQLiteQueuePlugin.

Referenced by org::xmlBlaster::util::queue::CacheQueuePlugin::empty(), org::xmlBlaster::util::dispatch::ConnectionsHandler::flushQueueUnlocked(), org::xmlBlaster::test::TestQueue::testOrder(), org::xmlBlaster::test::TestQueue::testWithOneConnectEntry(), and org::xmlBlaster::test::TestQueue::testWithOnePublishEntry().

virtual void org::xmlBlaster::util::queue::I_Queue::destroy (  )  [pure 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

Exceptions:
XmlBlasterException if failed

Implemented in org::xmlBlaster::util::queue::CacheQueuePlugin, org::xmlBlaster::util::queue::RamQueuePlugin, and org::xmlBlaster::util::queue::SQLiteQueuePlugin.

Referenced by org::xmlBlaster::util::queue::CacheQueuePlugin::destroy(), and org::xmlBlaster::test::TestQueue::destroyQueue().


The documentation for this class was generated from the following file: