Skip to content

Commit

Permalink
0002307: Outgoing batches are missing the sql message sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed May 29, 2015
1 parent 8b07f1a commit e4633f9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Expand Up @@ -41,6 +41,8 @@ public interface IIncomingBatchService {
public int countIncomingBatchesInError(String channelId);

public IncomingBatch findIncomingBatch(long batchId, String nodeId);

public void refreshIncomingBatch(IncomingBatch batch);

public List<IncomingBatch> findIncomingBatchErrors(int maxRows);

Expand Down
Expand Up @@ -919,7 +919,7 @@ public void batchInError(DataContext context, Throwable ex) {
/*
* Reread batch to make sure it wasn't set to IG or OK
*/
currentBatch = engine.getIncomingBatchService().findIncomingBatch(currentBatch.getBatchId(), currentBatch.getNodeId());
engine.getIncomingBatchService().refreshIncomingBatch(currentBatch);

Batch batch = context.getBatch();
if (context.getWriter() != null
Expand Down
Expand Up @@ -63,6 +63,12 @@ public IncomingBatchService(IParameterService parameterService,
setSqlMap(new IncomingBatchServiceSqlMap(symmetricDialect.getPlatform(),
createSqlReplacementTokens()));
}

public void refreshIncomingBatch(IncomingBatch batch) {
sqlTemplate.queryForObject(
getSql("selectIncomingBatchPrefixSql", "findIncomingBatchSql"),
new IncomingBatchMapper(batch), batch.getBatchId(), batch.getNodeId());
}

public IncomingBatch findIncomingBatch(long batchId, String nodeId) {
if (nodeId != null) {
Expand Down Expand Up @@ -363,8 +369,19 @@ public BatchId mapRow(Row rs) {
}

class IncomingBatchMapper implements ISqlRowMapper<IncomingBatch> {

IncomingBatch batchToRefresh = null;

public IncomingBatchMapper(IncomingBatch batchToRefresh) {
this.batchToRefresh = batchToRefresh;
}

public IncomingBatchMapper() {
}


public IncomingBatch mapRow(Row rs) {
IncomingBatch batch = new IncomingBatch();
IncomingBatch batch = batchToRefresh != null ? batchToRefresh : new IncomingBatch();
batch.setBatchId(rs.getLong("batch_id"));
batch.setNodeId(rs.getString("node_id"));
batch.setChannelId(rs.getString("channel_id"));
Expand Down

0 comments on commit e4633f9

Please sign in to comment.