Access to add and change pages is restricted. See: https://cwiki.apache.org/confluence/display/OFBIZ/Wiki+access

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. 

For POS specific data synchronisation, you can refer detail document which is specific to POS servers syncing. Below is step by step procedure with an example to run entity synchronisation feature of OFBiz. Current example shows the data syncing through http connection. There is also an option to use RMI service for data syncing.

Example:

Suppose, we have two OFBiz instances, one called "ofbiz-main" and one called "ofbiz-secondary".

We have to synchronise ofbiz-main server by pushing party and customers data from the ofbiz-secondary.

Similarly, we have to synchronise the data on the ofbiz-secondary with changes on the ofbiz-main, by pulling data of new catalog, categories and products.

Initial Steps:

  1. Setup a ofbiz-main server with required data

  2. Set the Time Zone value of ofbiz-secondary instance in ‘start.properties’ file of OFbiz similar to ofbiz-main instance or vice versa.

  3. Set sequenced-id-prefix  value for default delegator in ‘entityengine.xml’ on ofbiz-secondary server

  4. Set the domain/IP of target(ofbiz-main) server in ‘serviceengine.xml’ file for entity-sync-http on ofbiz-secondary server

  5. Set ‘maxPostSize’ value to "-1” for "http-connector” property in ‘framework/catalina/ofbiz-component.xml’ file on ofbiz-secondary server

  6. Get SSL certificate of ofbiz-main server and install it on ofbiz-secondary server

Data Pull from ofbiz-main to ofbiz-secondary server

Below is example to pull Products data from ofbiz-main to ofbiz-secondary server.

  1. Load below data on ofbiz-main server. This data defines the set of entities and packages that require to pull product data from main server. We can add/remove entities and packages as per data need

    <EntityGroup entityGroupId="PRODUCT_PULL" entityGroupName="Pull catalog, categories and product data from main server to secondary 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"/>
  2. Load Schedule job data(defined below) on ofbiz-secondary server or run service ‘runPullEntitySync’ manually on ofbiz-secondary server. We can schedule it as per requirement.

    <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-secondary 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-main from ofbiz-secondary server

Below is example to push customer/party data from ofbiz-secondary server to ofbiz-main server.

  1. Load below data on ofbiz-secondary server. This data defines the set of entities and packages that require to push customer data from ofbiz-secondary server. We can add/remove entities and packages as per data need

    <EntityGroup entityGroupId="PARTY_PUSH" entityGroupName="PUSH: ofbiz-secondary to ofbiz-main Server"/>
    <!-- Party, Contact and userlogin -->
    <EntityGroupEntry entityGroupId="PARTY_PUSH" entityOrPackage="org.apache.ofbiz.party.party" applEnumId="ESIA_INCLUDE"/>
    <EntityGroupEntry entityGroupId="PARTY_PUSH" entityOrPackage="org.apache.ofbiz.party.contact" applEnumId="ESIA_INCLUDE"/>
    <EntityGroupEntry entityGroupId="PARTY_PUSH" entityOrPackage="org.apache.ofbiz.security.securitygroup" applEnumId="ESIA_INCLUDE"/>
    <EntityGroupEntry entityGroupId="PARTY_PUSH" entityOrPackage="org.apache.ofbiz.security.login" applEnumId="ESIA_INCLUDE"/>
    <EntityGroupEntry entityGroupId="PARTY_PUSH" entityOrPackage="org.apache.ofbiz.common.user" applEnumId="ESIA_INCLUDE"/>
    
    <EntitySync entitySyncId="PARTY_PUSH" runStatusId="ESR_NOT_STARTED" syncSplitMillis="600000" syncEndBufferMillis="120000" targetServiceName="remoteStoreEntitySyncDataHttp" targetDelegatorName="default-no-eca" keepRemoveInfoHours="24" forPushOnly="Y"/>
    <EntitySyncIncludeGroup entitySyncId="PARTY_PUSH" entityGroupId="PARTY_PUSH"/>
  2. Load Schedule job data (defined below) on ofbiz-secondary server or run service ‘runEntitySync’ manually from ofbiz-secondary server

    <!-- Runtime data for job-->
     <RuntimeData runtimeDataId="PARTY_PUSH">
     <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="PARTY_PUSH"/>
     </map-Value>
     </map-Entry>
     </map-HashMap>
    </ofbiz-ser>
     ]]></runtimeInfo>
     </RuntimeData>
    <!-- Schedule service to run daily at the end of day, frequency can be modified as per requirement -->
     <JobSandbox jobId="PARTY_PUSH" jobName="Push Customers" runtimeDataId="PARTY_PUSH" runTime="2000-01-01 00:00:00.000" serviceName="runEntitySync" poolId="pool" runAsUser="system" tempExprId="HOUR_23"/>


  • No labels