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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.