Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ChakshuGautam authored Apr 1, 2023
1 parent f5047ca commit 5b1dc15
Showing 1 changed file with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,25 +90,28 @@ public void accept(Throwable e) {
@Override
public void accept(XMessage xMessage) {
if(xMessage.getApp() != null) {
XMessageDAO dao = XMessageDAOUtils.convertXMessageToDAO(xMessage);

redisCacheService.setXMessageDaoCache(xMessage.getTo().getUserID(), dao);

xMessageRepo
.insert(dao)
.doOnError(new Consumer<Throwable>() {
@Override
public void accept(Throwable e) {
redisCacheService.deleteXMessageDaoCache(xMessage.getTo().getUserID());
log.error("Exception in xMsg Dao Save:"+e.getMessage());
}
})
.subscribe(new Consumer<XMessageDAO>() {
@Override
public void accept(XMessageDAO xMessageDAO) {
log.info("XMessage Object saved is with sent user ID >> " + xMessageDAO.getUserId());
}
});
try{
XMessageDAO dao = XMessageDAOUtils.convertXMessageToDAO(xMessage);
redisCacheService.setXMessageDaoCache(xMessage.getTo().getUserID(), dao);
xMessageRepo
.insert(dao)
.doOnError(new Consumer<Throwable>() {
@Override
public void accept(Throwable e) {
redisCacheService.deleteXMessageDaoCache(xMessage.getTo().getUserID());
log.error("Exception in xMsg Dao Save:"+e.getMessage());
}
})
.subscribe(new Consumer<XMessageDAO>() {
@Override
public void accept(XMessageDAO xMessageDAO) {
log.info("XMessage Object saved is with sent user ID >> " + xMessageDAO.getUserId());
}
});
}catch(e){
log.error("Exception in convertXMessageToDAO:" + e.getMessage());
log.error("The current XMessage was " + xMessage.toXML());
}
} else {
log.info("XMessage -> app is empty");
}
Expand Down

0 comments on commit 5b1dc15

Please sign in to comment.