REQUIREMENT client.cpp.queue |
Type | NEW |
Priority | MEDIUM |
Status | CLOSED |
Topic | XmlBlaster provides a persistent queue implementation for C++ clients | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Des cription |
In C++ we have three plugins implementing the I_Queue interface. One is called "RAM" and is an in memory implementation, one is called "SQLite" and reuses the xmlBlaster C implementation of a peristent queue using the relational database SQLite. Finally you can use the "CACHE" queue implementation which implements a simple combination of the former two. This queue resides on the C++ client side and stores messages which can't be delivered to the xmlBlaster server during connection problems. The "RAM" queue is always available in the xmlBlaster client library, the "SQLite" persistence queue needs some setup which is described below. CACHE limitation
The CACHE class
If you have mainly persistent messages and need to take care on
your RAM consumption with many messages in queue consider to use
the "SQLite" persistent queue directly (without any RAM or CACHE)
with the option Setup
To use the persistent queue you need to download SQLite and compile it for
your platform, our C/C++ compilation needs Compilation with ant
First add those lines to your XMLBLASTER_PERSISTENT_QUEUE=1 sqlite.include.dir=/opt/sqlite-bin/include sqlite.lib.dir=/opt/sqlite-bin/lib and compile it: build cpp-delete cppor similiar (with verbose switched on): build -verbose -DXMLBLASTER_PERSISTENT_QUEUE=1 -Dsqlite.include.dir= ... cpp
This expects |
||||||||||||||||||||||||||||||||||||||||||||||||||||
Example CPP |
Here is an example how to play on command line with the client side queue and test the behaviour: java org.xmlBlaster.Main -call[core] true cd xmlBlaster/demo/c++/bin PublishDemo -persistent true -numPublish 100 -session.name publisher/1 -dispatch/connection/delay 5000 -dispatch/connection/pingInterval 1000 SubscribeDemo -persistentSubscribe true -dispatch/callback/retries -1 -dispatch/connection/delay 5000 -session.name subscriber/1 You can kill the above process, restart them and check that nothing is lost.
The SQLite database files resides as a default setting in your home directory,
here is an example for UNIX how to look into the database with the sqlite /home/joe/xmlBlasterClientCpp.db sqlite> .mode line sqlite> select * from xb_entries; dataId = 1083681933046933000 nodeId = /node/xmlBlaster_192_168_1_4_3412/client/publisher/1 queueName = connection_nodexmlBlaster_192_168_1_4_3412clientpublisher1 prio = 5 flag = MSG_RAW|publish durable = T byteSize = 257 blob = ... sqlite> .exit |
||||||||||||||||||||||||||||||||||||||||||||||||||||
Configure |
These parameters allow to configure the C++-client on command line, over xmlBlaster.properties or over the environment (with lower priority):
TestingThe testsuite resides in xmlBlaster/testsuite/src/c++ to compile it use ant (with the above build.properties settings): cd xmlBlaster build cpp-test
To run the tests invoke in directory TestQueue
NOTE: Configuration parameters are specified on command line (-someValue 17) or in the
xmlBlaster.properties file (someValue=17). See requirement "util.property" for details. |
||||||||||||||||||||||||||||||||||||||||||||||||||||
Todo |
The persistent queue implementation is finished and tested, but we need to:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
See CODE | Queue.h | ||||||||||||||||||||||||||||||||||||||||||||||||||||
See | TestQueue.cpp | ||||||||||||||||||||||||||||||||||||||||||||||||||||
See | http://www.sqlite.org/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
See | SQLite compile | ||||||||||||||||||||||||||||||||||||||||||||||||||||
See REQ | client.cpp.failsafe | ||||||||||||||||||||||||||||||||||||||||||||||||||||
See REQ | client.c.queue | ||||||||||||||||||||||||||||||||||||||||||||||||||||
See REQ | client.cpp | ||||||||||||||||||||||||||||||||||||||||||||||||||||
See REQ | Queue dump formating identical to SOCKET serialization | ||||||||||||||||||||||||||||||||||||||||||||||||||||
See TEST | TestQueue |
This page is generated from the requirement XML file xmlBlaster/doc/requirements/client.cpp.queue.xml