public long count() { return dbClient.notificationQueueDao().count(); }
/** * Give the notification queue so that it can be processed */ public Notification getFromQueue() { int batchSize = 1; List<NotificationQueueDto> notificationDtos = dbClient.notificationQueueDao().selectOldest(batchSize); if (notificationDtos.isEmpty()) { return null; } dbClient.notificationQueueDao().delete(notificationDtos); return convertToNotification(notificationDtos); }
/** * {@inheritDoc} */ @Override public void scheduleForSending(Notification notification) { NotificationQueueDto dto = NotificationQueueDto.toNotificationQueueDto(notification); dbClient.notificationQueueDao().insert(singletonList(dto)); }
@Before public void setUp() { when(dispatcher.getKey()).thenReturn("NewViolations"); when(emailChannel.getKey()).thenReturn("Email"); when(twitterChannel.getKey()).thenReturn("Twitter"); when(dbClient.openSession(anyBoolean())).thenReturn(dbSession); when(dbClient.propertiesDao()).thenReturn(propertiesDao); when(dbClient.notificationQueueDao()).thenReturn(notificationQueueDao); when(dbClient.authorizationDao()).thenReturn(authorizationDao); underTest = new DefaultNotificationManager(new NotificationChannel[] {emailChannel, twitterChannel}, dbClient); }
public long count() { return dbClient.notificationQueueDao().count(); }
/** * Give the notification queue so that it can be processed */ public Notification getFromQueue() { int batchSize = 1; List<NotificationQueueDto> notificationDtos = dbClient.notificationQueueDao().selectOldest(batchSize); if (notificationDtos.isEmpty()) { return null; } dbClient.notificationQueueDao().delete(notificationDtos); return convertToNotification(notificationDtos); }
/** * {@inheritDoc} */ @Override public void scheduleForSending(Notification notification) { NotificationQueueDto dto = NotificationQueueDto.toNotificationQueueDto(notification); dbClient.notificationQueueDao().insert(singletonList(dto)); }