Class MailjetMailNotificationHandler
java.lang.Object
es.kukenan.smartfi.microservice.communication.service.provider.impl.mailjet.MailjetMailNotificationHandler
- All Implemented Interfaces:
NotificationProviderHandler
@Component
@RefreshScope
public class MailjetMailNotificationHandler
extends Object
implements NotificationProviderHandler
Service class that holds all the mail notification sending bussiness logic.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate MailjetMailClientMailJet Rest client.private booleanProperty value of mailjet sandbox client. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccepts(NotificationChannel channel, NotificationProvider provider) Return true if this handler is able to send the given notification request.private StringgetExternalId(MessageProcessInfo message) Get external identifier from response message.private List<NotificationError>mapErrorsMessage(MessageProcessInfo message) Map response errors into aNotificationErrorlist.private NotificationResponseprocessResponseMessages(NotificationRequest request, MessageProcessInfo messageProcessInfo) Process response messages.send(NotificationRequest request, Template template, NotificationSenderService.MessageContext messageContext) Send a notification.
-
Field Details
-
sandbox
@Value("${mailjet.client.sandbox}") private boolean sandboxProperty value of mailjet sandbox client. -
mailjetMailClient
MailJet Rest client.
-
-
Constructor Details
-
MailjetMailNotificationHandler
public MailjetMailNotificationHandler()
-
-
Method Details
-
accepts
Description copied from interface:NotificationProviderHandlerReturn true if this handler is able to send the given notification request.- Specified by:
acceptsin interfaceNotificationProviderHandler- Parameters:
channel- notification channel.provider- the provider to use.- Returns:
- true if this handler is able to send the given notification request.
-
send
public NotificationResponse send(NotificationRequest request, Template template, NotificationSenderService.MessageContext messageContext) Description copied from interface:NotificationProviderHandlerSend a notification.- Specified by:
sendin interfaceNotificationProviderHandler- Parameters:
request- notification request.template- the template to use to send the notification request.messageContext- the message context of the notification.- Returns:
- the notification entity to store.
-
processResponseMessages
private NotificationResponse processResponseMessages(NotificationRequest request, MessageProcessInfo messageProcessInfo) Process response messages.- Parameters:
request-NotificationRequestmessageProcessInfo- aMessageProcessInfolist- Returns:
- the
NotificationResponseobject.
-
getExternalId
Get external identifier from response message.- Parameters:
message- the response message- Returns:
- the external identifier
-
mapErrorsMessage
Map response errors into aNotificationErrorlist.- Parameters:
message- Response message- Returns:
- a
NotificationErrorlist mapped by errors message
-