Skip to content

Commit

Permalink
Bug fix commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajjangid05 committed Apr 6, 2023
1 parent 6d30e22 commit 2ac68a9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void accept(ReceiverRecord<String, String> msg) {
attachments.put("Exception", ExceptionUtils.getStackTrace(e));
attachments.put("XMessage", currentXmsg.toString());
sentEmail(currentXmsg, "Error in Outbound", "PFA", recipient, null, attachments);
log.error("An Error Occored : "+e.getMessage());
log.error("An Error Occored : " + e.getMessage());
}
}
})
Expand All @@ -86,6 +86,7 @@ public void accept(Throwable e) {

/**
* Send outbound message to user using the current xmsg
*
* @param currentXmsg
* @throws Exception
*/
Expand All @@ -101,13 +102,13 @@ public void accept(Throwable e) {
attachments.put("Exception", ExceptionUtils.getStackTrace(e));
attachments.put("XMessage", currentXmsg.toString());
sentEmail(currentXmsg, "Error in Outbound", "PFA", recipient, null, attachments);
log.error("Exception in processOutBoundMessageF:"+e.getMessage());
log.error("Exception in processOutBoundMessageF:" + e.getMessage());
}
}).subscribe(new Consumer<XMessage>() {
@Override
public void accept(XMessage xMessage) {
if(xMessage.getApp() != null) {
try{
if (xMessage.getApp() != null) {
try {
XMessageDAO dao = XMessageDAOUtils.convertXMessageToDAO(xMessage);
redisCacheService.setXMessageDaoCache(xMessage.getTo().getUserID(), dao);
xMessageRepo
Expand All @@ -116,7 +117,7 @@ public void accept(XMessage xMessage) {
@Override
public void accept(Throwable e) {
redisCacheService.deleteXMessageDaoCache(xMessage.getTo().getUserID());
log.error("Exception in xMsg Dao Save:"+e.getMessage());
log.error("Exception in xMsg Dao Save:" + e.getMessage());
}
})
.subscribe(new Consumer<XMessageDAO>() {
Expand All @@ -125,31 +126,30 @@ public void accept(XMessageDAO xMessageDAO) {
log.info("XMessage Object saved is with sent user ID >> " + xMessageDAO.getUserId());
}
});
}catch(Exception e){
} catch (Exception e) {
HashMap<String, String> attachments = new HashMap<>();
attachments.put("Exception", ExceptionUtils.getStackTrace(e));
attachments.put("XMessage", currentXmsg.toString());
sentEmail(xMessage, "Error in Outbound", "PFA", recipient, null, attachments);
log.error("Exception in convertXMessageToDAO:" + e.getMessage());
e.printStackTrace();
try{
log.error("The current XMessage was " + xMessage.toXML());
}catch(JAXBException j) {
log.error("Unable to parse the current XMessage " + xMessage.toString());
}catch(Exception ge) {
log.error("Unable to parse the current XMessage ge " + xMessage.toString());
try {
log.error("The current XMessage was : " + xMessage.toString());
} catch (Exception ge) {
ge.printStackTrace();
log.error("Unable to parse the current XMessage : " + ge.getMessage() + " Xmessage : " + ge.getMessage());
}
e.printStackTrace();
}
} else {
log.info("XMessage -> app is empty");
log.info("XMessage -> app is empty");
}

}
});
}

private String redisKeyWithPrefix(String key) {
return System.getenv("ENV")+"-"+key;
return System.getenv("ENV") + "-" + key;
}

private void sentEmail(XMessage xMessage, String subject, String body, String recipient, String attachmentFileName, HashMap<String, String> attachments) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}:%line): %msg%n%throwable
</Pattern>
</layout>
</appender>
Expand Down

0 comments on commit 2ac68a9

Please sign in to comment.