Class NotificationApplicationService

java.lang.Object
com.example.orderplatform.notifications.application.NotificationApplicationService
All Implemented Interfaces:
NotificationLog

@Service @Transactional public class NotificationApplicationService extends Object implements NotificationLog
Application service that records notification intents after committed order and payment events.
  • Constructor Details

    • NotificationApplicationService

      public NotificationApplicationService(NotificationStore notifications)
  • Method Details

    • on

      @TransactionalEventListener(phase=AFTER_COMMIT) @Transactional(propagation=REQUIRES_NEW) public void on(OrderCreatedEvent event)
      Records a customer notification intent for a committed order.
      Parameters:
      event - committed order event
    • on

      @TransactionalEventListener(phase=AFTER_COMMIT) @Transactional(propagation=REQUIRES_NEW) public void on(PaymentAuthorizedEvent event)
      Records an operational notification intent for an authorized payment.
      Parameters:
      event - payment authorization event
    • listRecent

      @Transactional(readOnly=true) public List<NotificationSummary> listRecent()
      Lists recently recorded notification intents.
      Specified by:
      listRecent in interface NotificationLog
      Returns:
      notification summaries in reverse creation order