Skip to content

Commit

Permalink
Merge pull request #66 from woehrl01/rest_trigger_failure
Browse files Browse the repository at this point in the history
0003463: SyncTrigger via REST call does not return errorcode if trigger creation fails
  • Loading branch information
mmichalek committed Mar 1, 2018
2 parents b8f7088 + 101fd1d commit 5e35ff5
Showing 1 changed file with 13 additions and 0 deletions.
Expand Up @@ -49,6 +49,7 @@
import org.jumpmind.db.util.BasicDataSourcePropertyConstants;
import org.jumpmind.exception.IoException;
import org.jumpmind.symmetric.ISymmetricEngine;
import org.jumpmind.symmetric.SymmetricException;
import org.jumpmind.symmetric.common.Constants;
import org.jumpmind.symmetric.common.ParameterConstants;
import org.jumpmind.symmetric.io.data.writer.StructureDataWriter.PayloadType;
Expand Down Expand Up @@ -1343,6 +1344,8 @@ private void syncTriggersImpl(ISymmetricEngine engine, boolean force) {
ITriggerRouterService triggerRouterService = engine.getTriggerRouterService();
StringBuilder buffer = new StringBuilder();
triggerRouterService.syncTriggers(buffer, force);

assertTriggerCreation(triggerRouterService, null);
}

private void syncTriggersByTableImpl(ISymmetricEngine engine, String catalogName,
Expand All @@ -1354,7 +1357,17 @@ private void syncTriggersByTableImpl(ISymmetricEngine engine, String catalogName
if (table == null) {
throw new NotFoundException();
}

triggerRouterService.syncTriggers(table, force);
assertTriggerCreation(triggerRouterService, table);
}

private void assertTriggerCreation(ITriggerRouterService triggerRouterService, Table table){
for(Map.Entry<Trigger, Exception> failedTriggers : triggerRouterService.getFailedTriggers().entrySet()){
if(table == null || failedTriggers.getKey().getFullyQualifiedSourceTableName().equalsIgnoreCase(table.getFullyQualifiedTableName())){
throw new SymmetricException("Trigger creation failed", failedTriggers.getValue());
}
}
}

private void dropTriggersImpl(ISymmetricEngine engine) {
Expand Down

0 comments on commit 5e35ff5

Please sign in to comment.