Table of Contents |
---|
Introduction
To sync data of specific entities or packages between two or more OFBiz instances, we can use EntitySync functionality of OOTB. Data synchronisation can achieve by pull and push of data between OFBiz instances.
...
Suppose, we have two OFBiz instances, one called "ofbiz-master" and one called "ofbiz-slave".
We have to synchronise ofbiz-master server by pushing party and customers data from the ofbiz-slave.
Similarly, we have to synchronise the data on the ofbiz-slave server from with changes on the ofbiz-master, by pulling data of new catalog, categories and products.
...
Setup a ofbiz-master server with required data
Set the Time Zone value of ofbiz-slave instance in ‘start.properties’ file of OFbiz similar to ofbiz-master instance or vice versa.
Set sequenced-id-prefix value for default delegator in ‘entityengine.xml’ on ofbiz-slave server
Set the domain/IP of target(ofbiz-master) server in ‘serviceengine.xml’ file for entity-sync-http on ofbiz-slave server
Set ‘maxPostSize’ value to "-1” for "http-connector” property in ‘framework/catalina/ofbiz-component.xml’ file on ofbiz-slave server
Get SSL certificate of ofbiz-master server and install it on ofbiz-slave server
Data Pull from ofbiz-master to ofbiz-slave server
Below is example to pull Products data from ofbiz-master to ofbiz-slave server.
Load below data on ofbiz-master server. This data defines the set of entities and packages that require to pull product data from master server. We can add/remove entities and packages as per data need
Code Block language xml <EntityGroup entityGroupId="PRODUCT_PULL" entityGroupName="Pull catalog, categories and product data from master server to slave Server"/> <!-- Catalogs --> <EntityGroupEntry entityGroupId="PRODUCT_PULL" entityOrPackage="org.apache.ofbiz.product.catalog" applEnumId="ESIA_INCLUDE"/> <!-- Categories --> <EntityGroupEntry entityGroupId="PRODUCT_PULL" entityOrPackage="org.apache.ofbiz.product.category" applEnumId="ESIA_INCLUDE"/> <!-- Products --> <EntityGroupEntry entityGroupId="PRODUCT_PULL" entityOrPackage="org.apache.ofbiz.product.facility" applEnumId="ESIA_INCLUDE"/> <EntityGroupEntry entityGroupId="5507_2_PULL" entityOrPackage="org.apache.ofbiz.product.product" applEnumId="ESIA_INCLUDE"/> <EntityGroupEntry entityGroupId="5507_2_PULL" entityOrPackage="org.apache.ofbiz.product.feature" applEnumId="ESIA_INCLUDE"/> <EntityGroupEntry entityGroupId="5507_2_PULL" entityOrPackage="org.apache.ofbiz.product.price" applEnumId="ESIA_INCLUDE"/> <EntityGroupEntry entityGroupId="5507_2_PULL" entityOrPackage="org.apache.ofbiz.product.promo" applEnumId="ESIA_INCLUDE"/> <EntityGroupEntry entityGroupId="5507_2_PULL" entityOrPackage="org.apache.ofbiz.product.supplier" applEnumId="ESIA_INCLUDE"/> <EntitySync entitySyncId="PRODUCT_PULL" runStatusId="ESR_NOT_STARTED" syncSplitMillis="600000" syncEndBufferMillis="120000" keepRemoveInfoHours="24" forPullOnly="Y"/> <EntitySyncIncludeGroup entitySyncId="PRODUCT_PULL" entityGroupId="PRODUCT_PULL"/>
Load Schedule job data(defined below) on ofbiz-slave server or run service ‘runPullEntitySync’ manually on ofbiz-slave server. We can schedule it as per requirement.
Code Block language xml <RuntimeData runtimeDataId="PRODUCT_PULL"> <runtimeInfo><![CDATA[<?xml version="1.0" encoding="UTF-8"?> <ofbiz-ser> <map-HashMap> <map-Entry> <map-Key> <std-String value="entitySyncId"/> </map-Key> <map-Value> <std-String value="PRODUCT_PULL"/> </map-Value> <map-Key> <std-String value="remotePullAndReportEntitySyncDataName"/> </map-Key> <map-Value> <std-String value="remotePullAndReportEntitySyncDataHttp"/> </map-Value> </map-Entry> </map-HashMap> </ofbiz-ser> ]]></runtimeInfo> </RuntimeData> <!-- Schedule job onofbiz-slave server on daily basis at zero hour of day --> <JobSandbox jobId="PRODUCT_PULL" jobName="PULL Products" runtimeDataId="PRODUCT_PULL" runTime="2000-01-01 00:00:00.000" serviceName="runPullEntitySync" poolId="pool" runAsUser="system" tempExprId="HOUR_00"/>
Data Push to ofbiz-master from ofbiz-slave server
Below is example to push customer/party data from ofbiz-slave server to ofbiz-master server.
...