Class NotificationAuthenticationMessageListener
java.lang.Object
com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
com.broadleafcommerce.notification.service.messaging.NotificationAuthenticationMessageListener
public class NotificationAuthenticationMessageListener
extends AbstractEmailNotificationMessageListener
A message listener that triggers when an authentication event is received. Responsible for
creating the reset password and password changed email notifications.
- Author:
- Jon Fleschler (jfleschler)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
Fields inherited from class com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
EMAIL_DELIVERY, messages, notificationService, tenantProvider, typeFactory, userResolver
-
Constructor Summary
ConstructorsConstructorDescriptionNotificationAuthenticationMessageListener
(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, NotificationService<Notification> notificationService, org.springframework.context.MessageSource messages, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.data.tracking.core.context.ContextInfo
buildNotificationContext
(com.jayway.jsonpath.DocumentContext jsonContext) Build theContextInfo
for the current messageprotected String
Get the class name to identify this listener for handling message idempotency.protected String
getMessageType
(com.jayway.jsonpath.DocumentContext jsonContext) Determine which message type should be sent.protected String
getNotificationSubject
(com.jayway.jsonpath.DocumentContext jsonContext) Determine the subject to use for the email notification.protected String
getRecipientCommunicationPreferences
(String userId, String userType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) getRecipients
(com.jayway.jsonpath.DocumentContext jsonContext) Determine the recipients to use for the email notification.void
handleMessage
(org.springframework.messaging.Message<String> message) protected boolean
validateShouldSendNotification
(com.jayway.jsonpath.DocumentContext jsonContext) Validates the message type is present to send the email.Methods inherited from class com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
buildNotification, buildNotification, getDocumentContext, getIdempotentConsumptionService, getMessages, getNotificationService, getObjectMapper, getPayload, getTenantProvider, getTypeFactory, getUserResolver, handleMessageInternal, modifyNotification, modifyNotification, processMessage, resolveApplicationById, setTenantProvider, setUserResolver
-
Field Details
-
MESSAGE_TYPE_PATH
- See Also:
-
CUSTOMER_NAME_PATH
- See Also:
-
CUSTOMER_EMAIL_PATH
- See Also:
-
CUSTOMER_ID_PATH
- See Also:
-
CUSTOMER_TYPE_PATH
- See Also:
-
ADMIN_TYPE
- See Also:
-
-
Constructor Details
-
NotificationAuthenticationMessageListener
public NotificationAuthenticationMessageListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, NotificationService<Notification> notificationService, org.springframework.context.MessageSource messages, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
handleMessage
@StreamListener("authenticationMessageInputNotification") public void handleMessage(org.springframework.messaging.Message<String> message) -
getClassName
Description copied from class:AbstractEmailNotificationMessageListener
Get the class name to identify this listener for handling message idempotency.- Specified by:
getClassName
in classAbstractEmailNotificationMessageListener
- Returns:
- the listener's class name
-
validateShouldSendNotification
protected boolean validateShouldSendNotification(com.jayway.jsonpath.DocumentContext jsonContext) Validates the message type is present to send the email.- Specified by:
validateShouldSendNotification
in classAbstractEmailNotificationMessageListener
- Parameters:
jsonContext
- the message payload- Returns:
- whether the email should be sent
-
getMessageType
Description copied from class:AbstractEmailNotificationMessageListener
Determine which message type should be sent.- Specified by:
getMessageType
in classAbstractEmailNotificationMessageListener
- Parameters:
jsonContext
- the message payload- Returns:
- the message type to send
-
getNotificationSubject
Description copied from class:AbstractEmailNotificationMessageListener
Determine the subject to use for the email notification.- Specified by:
getNotificationSubject
in classAbstractEmailNotificationMessageListener
- Parameters:
jsonContext
- the message payload- Returns:
- the subject to use for the email notification
-
getRecipients
Description copied from class:AbstractEmailNotificationMessageListener
Determine the recipients to use for the email notification.- Specified by:
getRecipients
in classAbstractEmailNotificationMessageListener
- Parameters:
jsonContext
- the message payload- Returns:
- the recipients to use for the email notification
-
getRecipientCommunicationPreferences
-
buildNotificationContext
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildNotificationContext(com.jayway.jsonpath.DocumentContext jsonContext) Description copied from class:AbstractEmailNotificationMessageListener
Build theContextInfo
for the current message- Specified by:
buildNotificationContext
in classAbstractEmailNotificationMessageListener
- Parameters:
jsonContext
- the payload of the message- Returns:
- the NotificationContext for the current message
-