Replication Internals

Suuchi out of the box comes with Synchronous Sequential Replication during writes. It's fairly easy to build custom replicators.

Refer #27 and #23 on how Replication is implemented.


Working with Methods that handle Replication

When implementing a service sometimes as a developer we would like to know if a particular invocation is a replication invocation or not. May be you might want to send a metric for every write and don't want to send the same metric multiple times. Sometimes you would also want to do a specific operation only at the primary shard and not others. You can use the following snippet

class WriteService extends ... { 
  def write(...) = {
    if(Headers.PRIMARY_NODE_REQUEST_CTX.get()) {
        // do something if this is a primary replica