public bool processMessageForOFACCheck(Request request, bool fromErrorQueue) { //AuditUtil.getInstance().audit(request.RequestId, AuditLevel.Info, "Started processing the message"); bool bLocked = false; int iStatus = 0; bool bSuccess = false; Interface i = InterfaceManager.getInterface(request.InterfaceId); try { bLocked = _dbUtils.acquireLock(request.RequestId); if (bLocked) { iStatus = _dbUtils.getStatusByRequest(request.RequestId); if (iStatus == Convert.ToInt32(Status.Review)) { bSuccess = i.Driver.sendForOfacCheck(request); if (bSuccess) { request.Status = Status.SentForOfacCheck; request.IsError = false; _dbUtils.changeStatus(request); AuditUtil.getInstance().audit(request.RequestId, AuditLevel.Info, "Message sent for watchlist filtering check"); } } } else { LogUtil.logError("Cannot acquire lock for message :" + request.RequestId + ". Translation incomplete"); AuditUtil.getInstance().audit(request.RequestId, AuditLevel.Error, "Abort processing. Cannot acquire lock"); } } catch (Exception e) { LogUtil.log("Error while sending the message for OFAC check:" + request.RequestId, e); AuditUtil.getInstance().audit(request.RequestId, AuditLevel.Error, "Error while sending the message for OFAC check"); } finally { if (bLocked) { _dbUtils.releaseLock(request.RequestId); } } return(bSuccess); }
public void processResponse(int requestId, int interfaceId, String identifier, String responseBody, OfacStatus ofacStatus) { AuditUtil.getInstance().audit(requestId, AuditLevel.Info, "Received " + ofacStatus.ToString() + " response"); bool bLocked = false; bool bSuccess = false; Request request = null; Interface i = InterfaceManager.getInterface(interfaceId); try { bLocked = _dbUtils.acquireLock(requestId); if (bLocked) { request = _dbUtils.getRequest(requestId); if (request == null) { LogUtil.logError("Cannot retrieve the message:" + requestId); return; } if (request.Status != Status.SentForOfacCheck) { LogUtil.logError("Cannot process response for the message :" + requestId + " . Current status is " + request.Status + ". Expecting " + Status.SentForOfacCheck); return; } request.Status = Status.OfacResponseReceived; request.IsError = false; request.OfacStatus = ofacStatus; _dbUtils.changeStatus(request); request.ResponseMessage = i.Handler.getRepackagedResponseString(request.MessageBody, responseBody); if (i.Driver.sendResponse(request, identifier)) { request.Status = Status.Processed; request.IsError = false; _dbUtils.addResponseMessage(request); bSuccess = true; AuditUtil.getInstance().audit(requestId, AuditLevel.Info, "Sent response for the message "); } } } catch (Exception e) { bSuccess = false; LogUtil.log("Cannot process response for the message :" + requestId, e); AuditUtil.getInstance().audit(requestId, AuditLevel.Error, "Error processing response for the message "); } finally { try { if (!bSuccess) { _dbUtils.markRequestError(requestId); //send it to error if (request != null && i.Driver.shouldMoveToError()) { i.Driver.moveToError(request); } } if (bLocked) { _dbUtils.releaseLock(request.RequestId); } } catch (Exception e) { LogUtil.log("Exception when trying to backout of another exception for message:" + requestId, e); } } }
public void process(Request request) { AuditUtil.getInstance().audit(request.RequestId, AuditLevel.Info, "Started processing the message"); bool bLocked = false; bool bSuccess = false; Interface i = InterfaceManager.getInterface(request.InterfaceId); try { bLocked = _dbUtils.acquireLock(request.RequestId); if (bLocked) { //if (!_bSentForOFACCheck) //{ bSuccess = translateRequest(request, i); //If translation was success and the review flag is false //if (bSuccess && (_brequiresReview == false) && (_bSentForOFACCheck == false)) //{ // bSuccess = i.Driver.sendForOfacCheck(request); if (!bSuccess) //{ // request.Status = Status.SentForOfacCheck; // request.IsError = false; // _dbUtils.changeStatus(request); // AuditUtil.getInstance().audit(request.RequestId, AuditLevel.Info, "Translation review flag is not set. Message directly sent for watchlist filtering check"); //} //else { request.Status = Status.Translated; request.IsError = true; _dbUtils.changeStatus(request); LogUtil.logError("Error sending the message - " + request.RequestId + " for watchlist filtering check"); AuditUtil.getInstance().audit(request.RequestId, AuditLevel.Error, "Error sending the message for watchlist filtering check"); } //} } else { LogUtil.logError("Cannot acquire lock for message :" + request.RequestId + ". Translation incomplete"); AuditUtil.getInstance().audit(request.RequestId, AuditLevel.Error, "Abort processing. Cannot acquire lock"); } } catch (Exception e) { LogUtil.log("Error processing the message:" + request.RequestId, e); AuditUtil.getInstance().audit(request.RequestId, AuditLevel.Error, "Error processing the message"); } finally { if (!bSuccess) { _dbUtils.markRequestError(request.RequestId); if (i.Driver.shouldMoveToError()) { //send it to error i.Driver.moveToError(request); } } if (bLocked) { _dbUtils.releaseLock(request.RequestId); } } }