Enabling Your Plugin for Replication

The core replication engine in Bloomreach Content can replicate documents, assets, and images located under /content, as well as HST configuration. If your plugin defines a custom content model, you may need to extend the replication engine to support it. For example, the Relevance Module extends replication in this way.

To enable replication for your plugin, you must:

  1. Implement a component that informs the replication engine about your model’s units of replication—specifically, which nodes should be replicated as a single unit.
  2. Configure an additional content root if your model stores content outside the default replication scope.

Optionally, you can implement the PropertyFilter interface to exclude specific properties from replication.

ReplicationScopeProvider

To integrate your plugin’s content model with the replication engine, implement a ReplicationScopeProvider.

/** * Extension point that allows the replication engine to know how to deal with the content model of * a given sub system. */ public interface ReplicationScopeProvider { /** * Maps the given {@code node} to a {@link ReplicationScope}. This lets the engine * know whether to treat the node as the root of a unit of replication (ReplicationScope.REPLICABLE), * to include it within the scope of the an ancestor unit of replication (ReplicationScope.NONE), * to exclude it from replication (ReplicationScope.EXCLUDED), or to ignore it (ReplicationScope.IGNORED). * <p> * This method should return {@code null} if this provider does not know about the node in question, in * order that another provider may be consulted. */ ReplicationScope getReplicationScope(Node node) throws RepositoryException; /** * Whether the {@code event} in question could have had the effect that the node associated with * this event changed {@link ReplicationScope}. * For instance, a published variant has ReplicationScope.REPLICABLE when it is live, otherwise * it is ReplicationScope.EXCLUDED. * <p> * This method should return {@code null} if this provider does not know about the event in question, in * order that another provider may be consulted. */ Boolean isReplicationScopeChangeEvent(final Event event, final Session session) throws RepositoryException; }

When the source repository processes changes, the replication engine uses ReplicationScopeProvider implementations to map changed nodes to units of replication. A node can be:

  • Not replicable
  • The root of a unit of replication
  • A descendant of a replication root

When an event occurs, the change log monitor queries these providers to determine if the node should be replicated and, if so, which unit of replication applies. When creating and sending the replication package, the XML serializer uses the ReplicationScopeProvider to decide which nodes to include or exclude. You can also implement a PropertyFilter to prevent certain properties from being replicated.

Registering the Provider

You must register your provider with the replication engine. Register by adding a node of type hipposys:moduleconfig with a className property set to your provider’s fully qualified class name. Add this node as a child of /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata.

example_content_replication_provider.yaml

definitions: config: /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/examplecontent: jcr:primaryType: hipposys:moduleconfig className: com.example.replication.ExampleReplicationScopeProvider

Configuring the Replication Root

To include a node in replication, it must be mapped by a ReplicationScopeProvider and its path must be configured as described on the replication configuration page.

For example, the Relevance Module requires the path /targeting:targeting to be added to the includedpaths property of /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata. To add a value to this property, use the add operation in a YAML definition:

definitions: config: /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata: includedpaths: operation: add type: string value: [/example]
Share Feedback
Page: /build/enterprise-plugins/replication/enabling-your-plugin-for-replication
Section: Build
Category *
Enabling Your Plugin For Replication | Bloomreach Content Documentation