Class DefaultNotificationManager
java.lang.Object
com.broadleafcommerce.common.messaging.notification.DefaultNotificationManager
- All Implemented Interfaces:
NotificationManager
- Author:
- Jeff Fischer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Perform a task without response or exception notification -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Do a unit of work upon successful completion of the current transaction, or, execute the work immediately if transaction synchronization is not currently active.void
handle
(NotificationStateRepository repo, NotificationStateAware notifiable, String messageType) Notify the system in some way about the state change for the notifiable param.void
handleAsync
(NotificationStateRepository repo, NotificationStateAware notifiable, String messageType) Notify the system in some way about the state change for the notifiable param.void
handleAsync
(NotificationStateRepository repo, NotificationStateAware notifiable, String messageType, Runnable callback) Notify the system in some way about the state change for the notifiable param.void
init()
void
setEventPublisher
(org.springframework.context.ApplicationEventPublisher eventPublisher) void
setProperties
(NotificationManagerProperties properties)
-
Constructor Details
-
DefaultNotificationManager
-
-
Method Details
-
init
@PostConstruct public void init() -
handle
public void handle(@NonNull NotificationStateRepository repo, @NonNull NotificationStateAware notifiable, @NonNull String messageType) Description copied from interface:NotificationManager
Notify the system in some way about the state change for the notifiable param. Processing is handled through one or moreNotificationHandler
instances. This will update the given notifiable using repo. Subsequent checks of the latest notification state will require a re-read.- Specified by:
handle
in interfaceNotificationManager
- Parameters:
repo
- The service responsible for making the state change. Usually aRepository
instance.notifiable
- The object that experienced the state change. Usually a Spring Data entity instance.messageType
- The type of message correlating toDefaultNotificationHandler#messageType
.
-
handleAsync
public void handleAsync(@NonNull NotificationStateRepository repo, @NonNull NotificationStateAware notifiable, @NonNull String messageType, @Nullable Runnable callback) Description copied from interface:NotificationManager
Notify the system in some way about the state change for the notifiable param. Processing is handled through one or moreNotificationHandler
instances. This will update the given notifiable using repo. Subsequent checks of the latest notification state will require a re-read. Notably, this version will perform handling using a thread pool.- Specified by:
handleAsync
in interfaceNotificationManager
- Parameters:
repo
- The service responsible for making the state change. Usually aRepository
instance.notifiable
- The object that experienced the state change. Usually a Spring Data entity instance.messageType
- The type of message correlating toDefaultNotificationHandler#messageType
.callback
- Code snippet to execute after all notification handling operations are complete- See Also:
-
handleAsync
public void handleAsync(@NonNull NotificationStateRepository repo, @NonNull NotificationStateAware notifiable, @NonNull String messageType) Description copied from interface:NotificationManager
Notify the system in some way about the state change for the notifiable param. Processing is handled through one or moreNotificationHandler
instances. This will update the given notifiable using repo. Subsequent checks of the latest notification state will require a re-read. Notably, this version will perform handling using a thread pool.- Specified by:
handleAsync
in interfaceNotificationManager
- Parameters:
repo
- The service responsible for making the state change. Usually aRepository
instance.notifiable
- The object that experienced the state change. Usually a Spring Data entity instance.messageType
- The type of message correlating toDefaultNotificationHandler#messageType
.- See Also:
-
executePostTransactionCommitOrNow
Do a unit of work upon successful completion of the current transaction, or, execute the work immediately if transaction synchronization is not currently active.- Parameters:
work
- The work to perform
-
setEventPublisher
@Autowired public void setEventPublisher(@Nullable org.springframework.context.ApplicationEventPublisher eventPublisher) -
setProperties
-