Re: Derby replication system - Need help

2014-03-16 Thread George Toma


Hi all,


 I'm trying to achieve the following functionality  and I would like an 
opinion, advice from more experienced people:
 -
 the goal is to provide a replication system which will publish messages
 to a JMS queue ( OpenMQ) based on the changes that occur in the 
database tables.

*   using a JMS queue will allow me loosely coupled system design ( I'm 
opened for suggestion here too )

 E.g.


*  tables - tBook ( the table which is representing a book entity), 
tBookAuthor 

*  tables audit - tBook_aud, tBookAuthor_aud 

*     replication table : tReplicationMessage - this table holds the 
operation type ( insert/update/delete ), the changed columns, the table 
name ( e.g. tBook), and the primary key.

*  My current intention  is to provide a stored procedure which 
will 
publish the messages on the JMS queue ( triggered by the 
tReplicationMessage table changes). The values that change will be taken from 
the audit tables.

*     Google protocol buffers will be used as messages format ( faster, 
optimal solution)

What I don't like at this approach is the following case :


*     20 tables ( tBookFormat, tBookCategory etc), and each table with 
more 
than 1000 changes per second will trigger too many Java processes ( my 
stored procedure from tReplicationMessage table) to be executed for each 
change. What is the right way of implementing a batch system in order 
to be feasible( batch the messages, e.g. 5 messages, and fire a single 
Java process to send data to the JMS queue) ? 
    What is wrong here and what should be the best approach with Derby DB ?

Most
 of the opened discussions from internet debate Oracle with its build 
notification services, services which are missing on Derby, or ORM which
 triggers JMS messages ( my replication system applied to the db layer, 
not at ORM level e.g. connection.persist(), connection.close(), 
replication.send(message); ! )

I hope someone could advice me, or point me into the right direction.

Regards,
George



On Sunday, March 16, 2014 11:53 AM, George Toma toma.georg...@yahoo.com wrote:
 
Good afternoon,

 I'm trying to achieve the following functionality  and I would like an 
opinion, advice from more experienced people:
 - the goal is to provide a replication system which will publish messages to a 
JMS queue ( OpenMQ) based on the changes that occur in the database tables.


*     using a JMS queue will allow me loosely coupled system design 
( I'm opened for suggestion here too )

 E.g.


*  tables - tBook ( the table which is representing a book entity), 
tBookAuthor 

*  tables audit - tBook_aud, tBookAuthor_aud 

*     replication table : tReplicationMessage - this table holds the 
operation type ( insert/update/delete ), the changed columns, the table name ( 
e.g. tBook), and the primary key.

*  My current intention  is to provide a stored procedure which 
will publish the messages on the JMS queue ( triggered by the 
tReplicationMessage table changes). The values that change will be taken from 
the audit tables.

*     Google protocol buffers will be used as messages format ( faster, 
optimal solution)

What I don't like at this approach is the following case :


*     20 tables ( tBookFormat, tBookCategory etc), and each table with 
more than 1000 changes per second will trigger too many Java processes ( my 
stored procedure from tReplicationMessage table) to be executed for each 
change. What is the right way of implementing a batch system in order to be 
feasible( batch the messages, e.g. 5 messages, and fire a single Java process 
to send data to the JMS queue) ? 
    What is wrong here and what should be the best approach with Derby DB ?

Most of the opened discussions from internet debate Oracle with its build 
notification services, services which are missing on Derby, or ORM which 
triggers JMS messages ( my replication system applied to the db layer, not at 
ORM level e.g. connection.persist(), connection.close(), 
replication.send(message); ! )

I hope someone could advice me, or point me into the right direction.

Regards,
George

Adding a new record to a table

2014-03-16 Thread Bob M
On a regular basis I add a new record and delete the oldest record in my
table
The records have a key and up until recently were listed by date/time order
as I wish to have them

I understand that this is unnecessary but it is great to always find the
latest records at the end of the table

Now, after a tweek in the code, my newest records are being written at the
beginning of the table next to the oldest records ?

What code do I need to add, so that when any new record is added, it will
appear at the end of the table and not at the beginning ?

Thanks

Bob M



--
View this message in context: 
http://apache-database.10148.n7.nabble.com/Adding-a-new-record-to-a-table-tp138004.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.