synchronizationreplicationjcrinfinispanmodeshape

ModeShape server-client repositories synchronization


I want to deploy a server-client architecture based on ModeShape but I can't figure out how to configure ModeShape and Infinispan to achieve my goal.

Here is a typical use case:

So, my requirements are:

Do you have an idea how to get such a behavior by using the clustering options of ModeShape and/or Infinispan? Or maybe you can think of a better approach?


Solution

  • The main server's configuration would be pretty conventional. ModeShape (and Infinispan) are pretty flexible here, so the harder part is deciding upon how/where you want to persist all of ModeShape's content. The project has quite a few complete examples with various configurations, and lots of configurations for test cases that may also be helpful.

    As for the clients, I'd recommend having them store content in a local repository that persists to local disk, so that means using either Infinispan's JDBC cache store or the file system cache store. (With ModeShape 4.0, there are even a few other Infinispan cache stores that will work and perform even better.)

    Then the question is how to synchronize the data. ModeShape has clustering built-in, but having all repository instances be identical isn't quite what you want. Unfortunately, there is nothing in ModeShape that directly supports this functionality, but it's something you could implement on your own. Then the client could connect and download the subset of the main repository content (or those nodes that changed, based upon the event journal information) and then update its local copy. Of course, you'd probably want to ensure that you didn't overwrite any local content that was updated by the client but not yet synchronized to the server.

    Doing this will take some effort, but it is possible to do completely on top of ModeShape. Really, the bulk of the work entails merging the content of two independently-updated repositories using each repository's event journal (e.g., the journal of save transactions and what was changed in each transaction).