XmlBlaster Logo

REQUIREMENT

queue.jdbc.mysql

XmlBlaster Logo


Type NEW
Priority LOW
Status INWORK
Topic XmlBlaster has an advanced queuing facility. Among others, one tested persistence layer is offered by communicating with a MySQL database.
Des
cription

The generic plugin for jdbc based queues has been tested against MySQL using the Liberty Database abstraction layer. See also queue.jdbc.ldbc

MySQL Server is available from http://www.mysql.org/ where you can find all necessary information and instructions on how to make MySQL Server run.

Once you have a running database you can configure xmlBlaster to make it run against it. First you need to download the jdbc driver. http://www.mysql.com/downloads/api-jdbc.html You must put these files in the CLASSPATH (for example you can put them into $XMLBLASTER_HOME/lib and add them to the CLASSPATH or in your runtime library directory jre/lib/ext/.

Setup MySQL Server

  1. Note some default installs disable MySQL Networking. See /etc/mysql/my.cnf [mysqld] skip-networking
  2. Also increase the Maximum Packet Size. [mysqld] max_allowed_packet MySQL Default on Debian Woody is 1M (meg) xmlBlaster will fail some tests with a setting below 3M
  3. Create the database to be used. mysql; create database xmlb;
  4. Setup xmlBlaster.properties as described in the example section below
Example
Java
Configure

These parameters allow you to configure a cache queue running with MySQL Server

To activate persistence please add the following to your properties file:
persistence/topicStore/defaultPlugin=JDBC,1.0
persistence/msgUnitStore/defaultPlugin=CACHE,1.0

QueuePlugin[JDBC][1.0]=org.xmlBlaster.util.queue.jdbc.JdbcQueueCommonTablePlugin,\
                    url=jdbc:ldbc:mysql://localhost/xmlb,\
                    user=xmlb,\
                    password=secret,\
                    connectionPoolSize=1,\
                    connectionBusyTimeout=90000,\
                    maxWaitingThreads=300,\
                    tableNamePrefix=XB_,\
                    entriesTableName=ENTRIES,\
                    dbAdmin=true,\
                    cascadeDeleteSupported=false,\
                    nestedBracketsSupported=false,\
                    configurationIdentifier=ldbc
                    
QueuePlugin[RAM][1.0]=org.xmlBlaster.util.queue.ram.RamQueuePlugin
QueuePlugin[CACHE][1.0]=org.xmlBlaster.util.queue.cache.CacheQueueInterceptorPlugin,\
persistentQueue=JDBC,transientQueue=RAM

queue/subject/defaultPlugin=CACHE,1.0
queue/history/defaultPlugin=CACHE,1.0
queue/callback/defaultPlugin=CACHE,1.0
useTopicStore=true

JdbcDriver.drivers=org.ldbc.jdbc.jdbcDriver

JdbcDriver.mapping[ldbc]=string=varchar(128),"longint=decimal(19,0)",int=int,boolean=char(1),\
		blob=blob,pingStatement=Show All,blobVarName=ablob, keyAttr=not null
     
Property default comment
persistence/topicStore/defaultPlugin JDBC,1.0 The default persistance topic store plugin.
persistence/msgUnitStore/defaultPlugin CACHE,1.0 The default persistance message unit store plugin.
url jdbc:ldbc:mysql://localhost/xmlb The database url string. Example jdbc:ldbc:mysql://localhost:3306/xmlb
user xmlb The database user name.
password secret The database password
connectionPoolSize 1 The number of connections to the DB (tests showed that a low number gives the best performance).
connectionBusyTimeout 90000 The time to wait in milliseconds until to timeout when waiting for a connection to the DB.
maxWaitingThreads 300 The maximum number of threads waiting for a connection to the DB.
tableNamePrefix XB_ the name prefix for the table containing the entries. Note that the complete names for the tables are created by adding the tableNamePrefix to the names. So if you specify entriesTableName=ENTRIES and tableNamePrefix=XB_ you will get the name of the table to be XB_ENTRIES.
entriesTableName ENTRIES the name postfix for the table containing the entries.
dbAdmin true if set to true xmlBlaster will try to create tables if needed.
cascadeDeleteSupported false Ldbc does not currently support cascade delete. A code work around has been put in place.
nestedBracketsSupported false Ldbc does not support nested brackets in some queries.
configurationIdentifier ldbc The identifier used for database mapping. See JdbcDriver.mapping[ldbc]
maxStatementLength 2048 The maximum SQL statement length supported by this JDBC driver. If the JDBC meta data delivers this information this property is ignored.
enableBatchMode true Tells the driver to make the addition of entries in batch mode, i.e. several entries are added in the same sweep. This can improve performance on some DB's significantly. The drawback is that it could loose performance and create noisy logs in the case you insert several entries and one of them is already in the DB. Then everything would be rolled back and repeated in single mode (we can not save the current state since PostGres implicitly aborts transactions in case of an SQLException is thrown). If the DB used does not support batch mode, then this option is ignored.
QueuePlugin[RAM][1.0] org.xmlBlaster.util.queue.ram.RamQueuePlugin Ram based plugin.
QueuePlugin[CACHE][1.0] CacheQueueInterceptorPlugin,
persistentQueue=JDBC,
transientQueue=RAM
Cache plugin.
queue/subject/defaultPlugin CACHE,1.0 The queue subject default plugin.
queue/history/defaultPlugin CACHE,1.0 The queue history default plugin.
queue/callback/defaultPlugin CACHE,1.0 The queue callback default plugin.
useTopicStore false Use the topic store.

Additionally the configuration parameters for the ram queue and the jdbc queue must be defined.

NOTE: Configuration parameters are specified on command line (-someValue 17) or in the xmlBlaster.properties file (someValue=17). See requirement "util.property" for details.
Columns named Impl tells you if the feature is implemented.
Columns named Hot tells you if the configuration is changeable in hot operation.

See API org.xmlBlaster.util.queue.I_Queue
See API org.xmlBlaster.util.queue.jdbc.JdbcQueueCommonTablePlugin
See API org.xmlBlaster.util.queue.QueuePluginManager
See API org.xmlBlaster.util.queue.I_QueueEntry
See API org.xmlBlaster.util.qos.storage.QueuePropertyBase
See API org.xmlBlaster.util.I_Plugin
See API org.xmlBlaster.util.Global
See REQ queue
See REQ queue.jdbc.ldbc
See TEST org.xmlBlaster.test.classtest.queue.I_QueueTest
See TEST org.xmlBlaster.test.classtest.queue.JdbcQueueTest
See TEST org.xmlBlaster.test.classtest.queue.CacheQueueTest

This page is generated from the requirement XML file xmlBlaster/doc/requirements/queue.jdbc.mysql.xml

Back to overview