java.lang.Object
es.kukenan.smartfi.microservice.communication.service.provider.impl.mailjet.MailjetEventsService

@Service @RefreshScope public class MailjetEventsService extends Object
This class groups the logic to handle MailJet real time event notification API.
  • Field Details

    • eventsQueueController

      @Autowired private InternalMailJetEventsQueueController eventsQueueController
      Internal queue controller.
    • objectMapper

      @Autowired private es.kukenan.smartfi.common.utils.CustomObjectMapper objectMapper
      JSON to object mapper.
    • notificationStatusChangeService

      @Autowired private NotificationStatusChangeService notificationStatusChangeService
      The service that handles notification updates.
    • requestContextManager

      @Autowired private es.kukenan.smartfi.common.context.RequestContextManager requestContextManager
      Request context manager.
  • Constructor Details

    • MailjetEventsService

      public MailjetEventsService()
  • Method Details

    • receiveFromMailjet

      public void receiveFromMailjet(AbstractEvent... mailJetEvents)
      This method in invoked when a MailJet events are received. They will be published into an internal queue for load-balancing purposes (receiveFromInternalQueue(AbstractEvent)).
      Parameters:
      mailJetEvents - the MailJet real time API Events.
    • receiveFromInternalQueue

      public void receiveFromInternalQueue(AbstractEvent mailJetEvent)
      This method is invoked when a MailJet event is received. MailJet events must be converted to NotificationUpdate and then delegated to the NotificationStatusChangeService.
      Parameters:
      mailJetEvent - the MailJet real time API Event.
    • notificationStatus

      private NotificationStatus notificationStatus(AbstractEvent mailJetEvent)
      /** Get the notification status mapped from the event type.
      Parameters:
      mailJetEvent - the MailJet event.
      Returns:
      the notification status that corresponds to the given event type.
    • notificationComments

      private String notificationComments(AbstractEvent mailJetEvent)
      Create a custom comment value with specific concrete event information.
      Parameters:
      mailJetEvent - the MailJet event.
      Returns:
      a string with specific concrete event information.
    • safeObjectAsString

      private String safeObjectAsString(Object object)