You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ar...@apache.org on 2019/01/31 11:54:45 UTC

svn commit: r1852587 - in /ofbiz/ofbiz-framework/trunk/framework/entityext: servicedef/services.xml src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java

Author: arunpatidar
Date: Thu Jan 31 11:54:45 2019
New Revision: 1852587

URL: http://svn.apache.org/viewvc?rev=1852587&view=rev
Log:
Fixed: Services of EntitySync Push and Pull functionalities
(OFBIZ-10818)

Set transaction timeout of 2hrs for the actual data transmission services.
Removed unwanted service updateEntitySyncRunning
Called the tracking and status update services in new transaction so that record can be maintain after current transaction rollback

Modified:
    ofbiz/ofbiz-framework/trunk/framework/entityext/servicedef/services.xml
    ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java

Modified: ofbiz/ofbiz-framework/trunk/framework/entityext/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entityext/servicedef/services.xml?rev=1852587&r1=1852586&r2=1852587&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entityext/servicedef/services.xml (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entityext/servicedef/services.xml Thu Jan 31 11:54:45 2019
@@ -201,27 +201,19 @@ under the License.
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
 
-    <service name="updateEntitySyncRunning" default-entity-name="EntitySync" engine="entity-auto" invoke="update" auth="true">
-        <description>Update EntitySync</description>
-        <permission-service service-name="entitySyncPermissionCheck" main-action="UPDATE"/>
-        <auto-attributes include="pk" mode="IN" optional="false"/>
-        <auto-attributes include="nonpk" mode="IN" optional="true"/>
-    </service>
-
-    <service name="createEntitySyncHistory" default-entity-name="EntitySyncHistory" engine="entity-auto" invoke="create" auth="true">
+    <service name="createEntitySyncHistory" default-entity-name="EntitySyncHistory" engine="entity-auto" invoke="create" auth="true" require-new-transaction="true">
         <description>Create EntitySyncHistory</description>
         <permission-service service-name="entitySyncPermissionCheck" main-action="CREATE"/>
         <auto-attributes include="pk" mode="INOUT" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
-        <override name="startDate" mode="OUT"/>
     </service>
-    <service name="updateEntitySyncHistory" default-entity-name="EntitySyncHistory" engine="entity-auto" invoke="update" auth="true">
+    <service name="updateEntitySyncHistory" default-entity-name="EntitySyncHistory" engine="entity-auto" invoke="update" auth="true" require-new-transaction="true">
         <description>Update EntitySyncHistory</description>
         <permission-service service-name="entitySyncPermissionCheck" main-action="UPDATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
-    <service name="deleteEntitySyncHistory" default-entity-name="EntitySyncHistory" engine="entity-auto" invoke="delete" auth="true">
+    <service name="deleteEntitySyncHistory" default-entity-name="EntitySyncHistory" engine="entity-auto" invoke="delete" auth="true" require-new-transaction="true">
         <description>Delete EntitySyncHistory</description>
         <permission-service service-name="entitySyncPermissionCheck" main-action="DELETE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
@@ -307,12 +299,12 @@ under the License.
     </service>
 
     <!-- Services to call store (Push) remotely -->
-    <service name="remoteStoreEntitySyncDataHttp" engine="http" auth="true" use-transaction="false"
+    <service name="remoteStoreEntitySyncDataHttp" engine="http" auth="true" use-transaction="false" transaction-timeout="7200"
             location="entity-sync-http" invoke="storeEntitySyncData">
         <description>Remotely Store Entity Sync Date</description>
         <implements service="storeEntitySyncData"/>
     </service>
-    <service name="remoteStoreEntitySyncDataRmi" engine="rmi" auth="true" use-transaction="false"
+    <service name="remoteStoreEntitySyncDataRmi" engine="rmi" auth="true" use-transaction="false" transaction-timeout="7200"
             location="entity-sync-rmi" invoke="storeEntitySyncData">
         <description>Remotely Store Entity Sync Data</description>
         <implements service="storeEntitySyncData"/>

Modified: ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java?rev=1852587&r1=1852586&r2=1852587&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java Thu Jan 31 11:54:45 2019
@@ -309,7 +309,7 @@ public class EntitySyncContext {
             }
             this.startDate = (Timestamp) initialHistoryRes.get("startDate");
 
-            Map<String, Object> result = dispatcher.runSync("updateEntitySync", UtilMisc.toMap("entitySyncId", entitySyncId, "lastHistoryStartDate", this.startDate, "userLogin", userLogin));
+            Map<String, Object> result = dispatcher.runSync("updateEntitySync", UtilMisc.toMap("entitySyncId", entitySyncId, "lastHistoryStartDate", this.startDate, "userLogin", userLogin),60,true);
             if (ServiceUtil.isError(result)) {
                 throw new SyncDataErrorException(errorMsg, null, null, result, null);
             }
@@ -772,7 +772,7 @@ public class EntitySyncContext {
             this.totalRowsToRemove += this.toRemoveAlreadyDeleted + this.toRemoveDeleted;
 
             // store latest result on EntitySync, ie update lastSuccessfulSynchTime, should run in own tx
-            Map<String, Object> updateEsRunResult = dispatcher.runSync("updateEntitySyncRunning", UtilMisc.toMap("entitySyncId", entitySyncId, "lastSuccessfulSynchTime", this.currentRunEndTime, "userLogin", userLogin));
+            Map<String, Object> updateEsRunResult = dispatcher.runSync("updateEntitySync", UtilMisc.toMap("entitySyncId", entitySyncId, "lastSuccessfulSynchTime", this.currentRunEndTime, "userLogin", userLogin),60,true);
 
             GenericValue entitySyncHistory = EntityQuery.use(delegator).from("EntitySyncHistory").where("startDate",startDate, "entitySyncId", entitySyncId).queryOne();
             if(entitySyncHistory != null) {
@@ -832,7 +832,7 @@ public class EntitySyncContext {
         // the lastSuccessfulSynchTime on EntitySync will already be set, so just set status as completed
         String esErrMsg = "Could not mark Entity Sync as complete, but all synchronization was successful";
         try {
-            Map<String, Object> completeEntitySyncRes = dispatcher.runSync("updateEntitySyncRunning", UtilMisc.toMap("entitySyncId", entitySyncId, "runStatusId", newStatusId, "userLogin", userLogin));
+            Map<String, Object> completeEntitySyncRes = dispatcher.runSync("updateEntitySync", UtilMisc.toMap("entitySyncId", entitySyncId, "runStatusId", newStatusId, "userLogin", userLogin), 60,true);
             if (ServiceUtil.isError(completeEntitySyncRes)) {
                 // what to do here? try again?
                 throw new SyncDataErrorException(esErrMsg, null, null, completeEntitySyncRes, null);
@@ -925,7 +925,7 @@ public class EntitySyncContext {
     public void saveSyncErrorInfo(String runStatusId, List<Object> errorMessages) {
         // set error statuses on the EntitySync and EntitySyncHistory entities
         try {
-            Map<String, Object> errorEntitySyncRes = dispatcher.runSync("updateEntitySyncRunning", UtilMisc.toMap("entitySyncId", entitySyncId, "runStatusId", runStatusId, "userLogin", userLogin));
+            Map<String, Object> errorEntitySyncRes = dispatcher.runSync("updateEntitySync", UtilMisc.toMap("entitySyncId", entitySyncId, "runStatusId", runStatusId, "userLogin", userLogin), 60,true);
             if (ServiceUtil.isError(errorEntitySyncRes)) {
                 errorMessages.add("Could not save error run status [" + runStatusId + "] on EntitySync with ID [" + entitySyncId + "]: " + errorEntitySyncRes.get(ModelService.ERROR_MESSAGE));
             }
@@ -959,7 +959,7 @@ public class EntitySyncContext {
         try {
             // not running, get started NOW
             // set running status on entity sync, run in its own tx
-            Map<String, Object> startEntitySyncRes = dispatcher.runSync("updateEntitySyncRunning", UtilMisc.toMap("entitySyncId", entitySyncId, "runStatusId", "ESR_RUNNING", "userLogin", userLogin));
+            Map<String, Object> startEntitySyncRes = dispatcher.runSync("updateEntitySync", UtilMisc.toMap("entitySyncId", entitySyncId, "runStatusId", "ESR_RUNNING", "userLogin", userLogin), 60,true);
             if (ModelService.RESPOND_ERROR.equals(startEntitySyncRes.get(ModelService.RESPONSE_MESSAGE))) {
                 throw new SyncDataErrorException(markErrorMsg, null, null, startEntitySyncRes, null);
             }
@@ -1039,7 +1039,7 @@ public class EntitySyncContext {
             try {
                 // not running, get started NOW
                 // set running status on entity sync, run in its own tx
-                Map<String, Object> startEntitySyncRes = dispatcher.runSync("updateEntitySyncRunning", UtilMisc.toMap("entitySyncId", entitySyncId, "runStatusId", "ESR_RUNNING", "userLogin", userLogin));
+                Map<String, Object> startEntitySyncRes = dispatcher.runSync("updateEntitySync", UtilMisc.toMap("entitySyncId", entitySyncId, "runStatusId", "ESR_RUNNING", "userLogin", userLogin),60,true);
                 if (ModelService.RESPOND_ERROR.equals(startEntitySyncRes.get(ModelService.RESPONSE_MESSAGE))) {
                     throw new SyncDataErrorException(markErrorMsg, null, null, startEntitySyncRes, null);
                 }
@@ -1111,7 +1111,7 @@ public class EntitySyncContext {
         try {
             // not running, get started NOW
             // set running status on entity sync, run in its own tx
-            Map<String, Object> startEntitySyncRes = dispatcher.runSync("updateEntitySyncRunning", UtilMisc.toMap("entitySyncId", entitySyncId, "runStatusId", "ESR_RUNNING", "preOfflineSynchTime", this.lastSuccessfulSynchTime, "userLogin", userLogin));
+            Map<String, Object> startEntitySyncRes = dispatcher.runSync("updateEntitySync", UtilMisc.toMap("entitySyncId", entitySyncId, "runStatusId", "ESR_RUNNING", "preOfflineSynchTime", this.lastSuccessfulSynchTime, "userLogin", userLogin),60,true);
             if (ModelService.RESPOND_ERROR.equals(startEntitySyncRes.get(ModelService.RESPONSE_MESSAGE))) {
                 throw new SyncDataErrorException(markErrorMsg, null, null, startEntitySyncRes, null);
             }