Fix su publications
This commit is contained in:
@@ -8,6 +8,7 @@ import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.settings.SettingsController;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityDebug;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.StbPublicationsDetail;
|
||||
import it.integry.ems_model.entity.StbTransactionLog;
|
||||
@@ -49,10 +50,10 @@ public class AsyncManager {
|
||||
|
||||
@PostContextConstruct
|
||||
public void init() {
|
||||
//if (!UtilityDebug.isDebugExecution() && !UtilityDebug.isIntegryServer()) {
|
||||
looperService.add(this::internalCachePublicationsSetup, 5 * 60 * 1000, "sync-setup-cache");
|
||||
looperService.add(this::consumeToBeSavedQueue, 20 * 1000, "sync-flush-data");
|
||||
//}
|
||||
if (!UtilityDebug.isDebugExecution() && !UtilityDebug.isIntegryServer()) {
|
||||
looperService.add(this::internalCachePublicationsSetup, 5 * 60 * 1000, "sync-setup-cache");
|
||||
looperService.add(this::consumeToBeSavedQueue, 20 * 1000, "sync-flush-data");
|
||||
}
|
||||
}
|
||||
|
||||
private void internalCachePublicationsSetup() {
|
||||
@@ -108,14 +109,14 @@ public class AsyncManager {
|
||||
if (activePublication == null)
|
||||
return 0;
|
||||
|
||||
logger.debug("SYNC OFFLINE ABILITATA SU " + tableName);
|
||||
//logger.debug("SYNC OFFLINE ABILITATA SU " + tableName);
|
||||
|
||||
List<EntityBase> myObjs = new ArrayList<>();
|
||||
myObjs.add(entityBase);
|
||||
|
||||
String selectSql = "SELECT * FROM " + entityBase.getClass().getCanonicalName();
|
||||
if (!UtilityString.isNullOrEmpty(activePublication.getWhereCondSql())) {
|
||||
selectSql = selectSql + " WHERE " + activePublication.getWhereCondSql();
|
||||
if (!UtilityString.isNullOrEmpty(activePublication.getWhereCondField())) {
|
||||
selectSql = selectSql + " WHERE " + activePublication.getWhereCondField();
|
||||
}
|
||||
|
||||
// Create a new Query.
|
||||
@@ -178,7 +179,7 @@ public class AsyncManager {
|
||||
|
||||
|
||||
private void consumeToBeSavedQueue() {
|
||||
if(cachedSetup.entrySet().stream().anyMatch(x -> x.getValue() != null && x.getValue().stream().anyMatch(y -> !y.isReadyToTransmit())))
|
||||
if (cachedSetup.entrySet().stream().anyMatch(x -> x.getValue() != null && x.getValue().stream().anyMatch(y -> !y.isReadyToTransmit())))
|
||||
return;
|
||||
|
||||
List<String> dbNamesToConnect = toBeSavedQueue.stream().map(Map.Entry::getKey).distinct().collect(Collectors.toList());
|
||||
@@ -203,7 +204,7 @@ public class AsyncManager {
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(connectionModel);
|
||||
SQLServerPreparedStatement insertBulkPs = (SQLServerPreparedStatement) multiDBTransactionManager.prepareStatement(insertSQL)) {
|
||||
|
||||
insertBulkPs.setLong(1, stbTransactionLog.getGroupId());
|
||||
insertBulkPs.setLong(1, stbTransactionLog.getPublicationGroupId());
|
||||
insertBulkPs.setObject(2, stbTransactionLog.getCreatedAt());
|
||||
insertBulkPs.setString(3, stbTransactionLog.getUserName());
|
||||
insertBulkPs.setString(4, stbTransactionLog.getEntities());
|
||||
|
||||
@@ -170,7 +170,7 @@ public class RemoteSynchronizationService {
|
||||
HashMap<String, String> queryParams = new HashMap<String, String>() {{
|
||||
put("profileDb", subscription.getProfileDb());
|
||||
put("lastRetrievedTransactionId", subscription.getLastTransactionIdImported() == null ? null : String.valueOf(subscription.getLastTransactionIdImported()));
|
||||
put("limit", String.valueOf(200));
|
||||
put("limit", String.valueOf(500));
|
||||
}};
|
||||
|
||||
String retrieveTransactionsUrl = endpoint + "/ems-api/system/remote-transaction/" + subscription.getPublicationId() + "/retrieve";
|
||||
|
||||
Reference in New Issue
Block a user