DualCrud

DualCrud is a persistence utility that allows you to offer a meta instance of a persistence service to its client (for example: a business service). This is especially useful if you want to perform on the fly migration of data models. 

Consider following, classical structure:

Now, if you want to migrate this structure to jpa (*Repository) in running system, without downtime, you could construct following DC Structure:

... and you are done (wink)

Btw: The components in green are provided by the library.

 

 

DualCrud supports following pre-configured modes

Name

Effect

migrateOnTheFly

whenever an item on left persistence is accessed it is migrated to the right persistance.

migrateBackOnTheFly

same as migrateBackOnTheFly but in reverse direction.

migrateOnCallOnly

only explicit calls to migrate will trigger data movement from left to right.

migrateBackOnCallOnly

same as migrateOnCallOnly but in reverse direction.

duplicate

read from left but write to both. Useable if you want to have a failover copy.

useLeftOnly

Use only left persistence.

useRightOnly

Use only right persistence.

To create one of the above modes use static factory methods in net.anotheria.anoprise.dualcrud.DualCrudConfig

DualCrud Config properties

The static factory methods in DualCrud configs create broad-purpose configs. However, if the one you're looking for is not there, you can create your own config by setting the properties in the config object directly.

Name

Effect

migrationDirection

direction in which the data should be migrated

readFromBoth

if true after the primary persistence is asked for a data, and returned null or throwed exception, secondary persistence is asked

migrateOnRead

If true and a migration direction is specified, reading from old persistence will cause a migration.

writeToBoth

If true, the service will write to both peristences.

deleteUponMigration

If true upon a successful migration the old copy will be deleted.

migrateOnWrite

If true and a migration direction is specified, writing is only allowed to new persistence. Items on 'old' persistence are migrated to new on write.

  • No labels