XmlBlaster Logo

REQUIREMENT

queue.jdbc

XmlBlaster Logo


Type NEW
Priority HIGH
Status CLOSED
Topic Describes xmlBlaster persistence layer since v2.0 (2008-11-20).
Des
cription

The new xmlBlaster store replaces the old queue.jdbc.commontable since xmlBlaster release newer than v1.6.4.

It is acivated in xmlBlaster.properties by using the JdbcQueue plugin org.xmlBlaster.util.queue.jdbc.JdbcQueue instead of the old org.xmlBlaster.util.queue.jdbc.JdbcQueueCommonTablePlugin. This example shows the Postgres setup:

JdbcStorage[postgres]=org.xmlBlaster.util.queue.jdbc.JdbcQueue,\
            url=jdbc:postgresql://localhost:5432/xmlblaster,\
            user=xmlblast,\
            password=,\
            connectionPoolSize=5,\
            connectionBusyTimeout=90000,\
            maxWaitingThreads=300,\
            queue.persistent.queryTimeout=0,\
            tableNamePrefix=XB_,entriesTableName=ENTRIES,\
            dbAdmin=true
     

The entry tableNamePrefix=XB_,entriesTableName=ENTRIES,\ or (for SQLServer) tableNamePrefix=XB_,entriesTableName=ENTRIES,colNamePrefix=XB_,\ is needed only during database migration from old to new with java -Xms18M -Xmx1064M org.xmlBlaster.contrib.dbupdate.OneToThree and can be removed thereafter.

The new database schema consist of three database tables, namely xbstore, xbref and xbmeat. The DDL is located in directory xmlBlaster/doc/jdbc, here is an excerpt for Postgres:

create table xbstore (
      xbstoreid int8 primary key unique not null,
      xbnode varchar(256) not null,
      xbtype varchar(32) not null,
      xbpostfix varchar(256) not null,
      xbrefcounted char(1) not null default 'F',
      xbflag1 varchar(32) default '');

create table xbmeat (
      xbmeatid int8 not null,
      xbdurable char not null default 'F',
      xbrefcount int4,
      xbrefcount2 int4,
      xbbytesize int8,
      xbdatatype varchar(32) not null default '',
      xbmetainfo text default '',
      xbflag1 varchar(32) default '',
      xbmsgqos text default '',
      xbmsgcont bytea default '',
      xbmsgkey text default '',
      xbstoreid int8 not null,
      constraint xbmeatpk primary key(xbmeatid, xbstoreid));

create table xbref (
   xbrefid int8 not null,
   xbstoreid int8 not null,
   xbmeatid int8,
   xbdurable char(1) not null default 'F',
   xbbytesize int8,
   xbmetainfo text default '',
   xbflag1 varchar(32) default '',
   xbprio int4,
   xbmethodname varchar(32) default '',
constraint xbrefpk primary key(xbrefid, xbstoreid));

Discussion

The xbstore.xbisrefcounted only is used for xbstore describing xbref, it is of no useful interest with xbmeat

Configure To activate persistence please add the following to your properties file:
persistence/defaultPlugin=CACHE,1.0
queue/defaultPlugin=CACHE,1.0
useTopicStore=true
     
StoragePlugin[JDBC][1.0]=org.xmlBlaster.util.queue.jdbc.JdbcQueueCommonTablePlugin,\
                         entriesTableName=ENTRIES,\
                         tableNamePrefix=XB,\
                         dbAdmin=true,\
                         configurationIdentifier=mySpecialDB
     
Property default comment
entriesTableName ENTRIES the name postfix for the table containing the entries.
tableNamePrefix
DEPRECATED
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.
dbAdmin true if set to true xmlBlaster will try to create tables if needed.
configurationIdentifier $DatabaseMetaData.getDatabaseProductName()$ The ID to assign to this configuration. Its only purpose is to find the correct Mapping declaration for this database configuration. This name must match the name inside the square brackets. If you define configurationIdentifier=myStrangeDB here, then you will need to define the associated mapping: JdbcDriver.mapping[myStrangeDB]=longint=numeric (19),boolean=char(1),blob=image. If you don't define anything here, then the database product name is taken (which you get with DatabaseMetaData.getDatabaseProductName()).
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
DEPRECATED
xmlBlaster The prefix to use in the tablenames. All tables used will start with the uppercase of the text specified here. Do not choose names which are too long since many DB have a limited tablename length.
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.
cascadeDeleteSupported true Tells the driver that cascade delete is supported. When this is set (default), deleting a queue will delete all entries within the same SQL statement.
nestedBracketsSupported true Tells the driver wether nested brackets are supported or not. It normally is supported.
There is also the need to specify which mapping to use for the conversion from java types to the types used for a particular database. This is done with the JdbcDriver.mapping[xxx] property. The value specified here as xxx is the plugin property configurationIdentifier
JdbcDriver.mapping[myStrangeDB]=string=text,\
                                longint=bigint,\
                                int=integer,\
                                boolean=char(1),\
                                blob=bytea,\
                                pingStatement=SHOW ALL,\
                                blobVarName=blob,\
                                keyAttr=
     
Subproperty default comment
string text The name be used for the java.String type
longint bigint The name be used for the java.Long type (or long)
int integer The name be used for the java.Integer (or int) type
boolean char(1) The name be used for the java.Boolean (or boolean) type (a char is used since oracle does not support boolean)
blob bytea The name be used for the blobs (mapped to byte[])
pingStatement SHOW ALL The SQL stement to use to simulate a ping to the DB
blobVarName blob The name to assign to the table column for the blob. This has been added since the name blob is invalid because it is an internal keyword.
keyAttr (empty string) Additional attributes to the PRIMARY KEY to describe the primary key. Some DB need not null being added here
Note that the separator for the subproperties is a comma (,). If for some reasons you need to use a comma inside the subproperty (for example if you want to define ...,longint=decimal(19,0),..., then you can surround the whole subproperty (important) by a double quote (") as ...,"longint=decimal(19,0)",...

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.JdbcQueue
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 The old persistence layer, used until xmlBlaster v1.6.4
See REQ queue.jdbc.postgres
See REQ queue.jdbc.oracle
See REQ queue.jdbc.firebird
See REQ queue.jdbc.sqlserver
See REQ queue.jdbc.hsqldb
See REQ queue.jdbc.mysql
See REQ queue.jdbc.ldbc

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

Back to overview