From 47db22e69c2a3f80f4ea6f970cea6a8146dd5517 Mon Sep 17 00:00:00 2001 From: rajesh Date: Fri, 26 Sep 2025 20:04:33 +0530 Subject: [PATCH] Handled notification --- .../tendermanagement/dao/NotificationDao.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/gepafin/tendermanagement/dao/NotificationDao.java b/src/main/java/net/gepafin/tendermanagement/dao/NotificationDao.java index 55ec6665..57236418 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/NotificationDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/NotificationDao.java @@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.jpa.domain.Specification; +import org.springframework.messaging.MessagingException; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Component; @@ -105,7 +106,11 @@ public class NotificationDao { String userChannel = GepafinConstant.COMMON_SINGLE_CHANNEL_PREFIX + userId; log.info("Channel for User {}", userChannel); NotificationResponse notificationResponse = convertNotificationEntityToNotificationResponse(notificationEntity); - messagingTemplate.convertAndSend(userChannel, notificationResponse); + try { + messagingTemplate.convertAndSend(userChannel, notificationResponse); + } catch (Exception e) { + log.error("Error while sending the notification {0}", e); + } } private void sendToCompanies(Long userId, List companyIds, NotificationEntity notificationEntity) { @@ -120,7 +125,11 @@ public class NotificationDao { notificationEntity.setUserWithCompany(userWithCompany); notificationRepository.save(notificationEntity); NotificationResponse notificationResponse = convertNotificationEntityToNotificationResponse(notificationEntity); - messagingTemplate.convertAndSend(companyChannel, notificationResponse); + try { + messagingTemplate.convertAndSend(companyChannel, notificationResponse); + } catch (Exception e) { + log.error("Error while sending the notification {0}", e); + } }); }