Publishing Message-Based Notifications

The NotificationService provides a single method for publishing DomainEvent instances over a messaging infrastructure. Here is the service method:

public class NotificationService {     ...     @Transactional     public void publishNotifications() {         PublishedMessageTracker publishedMessageTracker =             this.publishedMessageTracker();         List<Notification> notifications =             this.listUnpublishedNotifications(                     publishedMessageTracker                             .mostRecentPublishedMessageId());         MessageProducer messageProducer = this.messageProducer();         try {             for (Notification notification : notifications) ...

Get Implementing Domain-Driven Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.