8.3 Multiple Instance - adobe/commerce-salesforce GitHub Wiki

Multiple SFCC instances support

A single AEM instance can connect to multiple SFCC instances. Each SFCC instance must have a unique identifier, the instanceId, that is used to match configurations for different parts of the Connector. The 'instanceId' is needed to configure replication to SFCC, content preview of AEM pages in Edit Mode and product import.

In the example below (also refer to the module content-multi-sample) we have two sites hosted on the AEM Author instance: US SiteGenesis and EU SiteGenesis. Each site is connected to its own dedicated Salesforce Commerce Cloud instance.

Also, each site has a dedicated area in DAM. In addition, the two instances share a common shared library that is replicated to both instances. This is achieved by granting both replication agents read-access to the shared folder. Note, however, that the shared library has to have the same name on both instances.

Multiple SFCC

Replication Setup

The content replication from AEM to SFCC is done via AEM Replication using the custom Demandware Replication Agent (the implementation can be found in the cq-commerce-demandware-replication bundle).

The configured agents are found in the package content-multi-sample package

Setup Replication Agent User Account

These are the internel User IDs, that are used by the two replication agents as "filters":

/home/users/system/demandware/
  - dwre-replication-agent-eu-sitegenesis
  - dwre-replication-agent-us-sitegenesis

Grant Read Access to Sites and Assets

In the paths

/content/eu-sitegenesis/_rep_policy.xml
/content/dam/eu-sitegenesis/_rep_policy.xml

and

/content/us-sitegenesis/_rep_policy.xml
/content/dam/us-sitegenesis/_rep_policy.xml

and

/content/dam/shared-sitegenesis/_rep_policy.xml

you can find sample definitions of required access control entries.

Replication Agent Configuration

The replication agents in turn are configured here:

/etc/replication/agents.author/
  - demandware-eu-sitegenesis
  - demandware-us-sitegenesis

Mind the settings transportUri, which contains the instanceID (e.g. "eu-sitegenesis") that also is used in the OSGi configurations and the userId which references to the system user defined above.

<jcr:content
  jcr:title="EU Sitegenesis Demandware Content Export Agent"
  sling:resourceType="commerce/demandware/components/replication/demandware"
  serializationType="demandware"
  transportUri="demandware://eu-sitegenesis"
  userId="dwre-replication-agent-eu-sitegenesis"

  [...]
 />

OSGi Services Configuration

The required OSGi Services with the according instanceIds is here:

/apps/commerce/demandware/config.author
  - com.adobe.cq.commerce.demandware.connection.DemandwareClientImpl-eu-sitegenesis.config
  - com.adobe.cq.commerce.demandware.connection.DemandwareClientImpl-us-sitegenesis.config
  - ...